-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#29618: adding new Github worflow to automate the 'Next Release' lab…
…eling.
- Loading branch information
1 parent
f9eb9a3
commit b365d23
Showing
2 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# action.yml | ||
name: 'QA not needed update' | ||
on: | ||
workflow_call: | ||
secrets: | ||
CI_MACHINE_TOKEN: | ||
description: 'CI machine token' | ||
required: true | ||
workflow_dispatch: | ||
inputs: | ||
issue_number: | ||
description: 'Issue number' | ||
type: number | ||
required: false | ||
label: | ||
description: 'Label' | ||
type: string | ||
required: false | ||
|
||
jobs: | ||
qa-not-needed-update: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
QA_NOT_NEEDED_LABEL: 'QA : Not Needed' | ||
steps: | ||
- run: echo 'GitHub context' | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
- name: Validate inputs | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const issue = context.payload.issue; | ||
if (!issue && '${{ inputs.issue_number }}'.trim() === '') { | ||
console.log('Issue number is not provided'); | ||
process.exit(0); | ||
} | ||
const label = context.payload.label; | ||
if (!label && '${{ inputs.label }}' !== '${{ env.QA_NOT_NEEDED_LABEL }}') { | ||
console.log('Label is not "${{ env.QA_NOT_NEEDED_LABEL }}", exiting'); | ||
process.exit(0); | ||
} | ||
- name: Add Next Release label | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
retries: 3 | ||
retry-exempt-status-codes: 400,401 | ||
github-token: ${{ secrets.CI_MACHINE_TOKEN }} | ||
script: | | ||
const issue = context.payload.issue || await github.rest.issues.get({ | ||
issue_number: ${{ inputs.issue_number }}, | ||
owner: '${{ github.repository_owner }}', | ||
repo: 'core' | ||
}); | ||
if (!issue) { | ||
console.log('Issue [${{ inputs.issue_number }}] not found'); | ||
process.exit(0); | ||
} | ||
console.log(`Issue: ${JSON.stringify(issue, null, 2)}`); | ||
const dropAndLearnText = 'Drop Everything & Learn'; | ||
if (issue.data.title.includes(dropAndLearnText)) { | ||
console.log(`Issue does have "${dropAndLearnText}" text in title, exiting`); | ||
process.exit(0); | ||
} | ||
const typeCicdLabel = 'Type : CI/CD'; | ||
const foundLabel = issue.data.labels.find(label => label.name === typeCicdLabel); | ||
if (foundLabel) { | ||
console.log(`Issue does have "${typeCicdLabel}" label , exiting`); | ||
process.exit(0); | ||
} | ||
await github.rest.issues.addLabels({ | ||
issue_number: ${{ inputs.issue_number }}, | ||
owner: '${{ github.repository_owner }}', | ||
repo: 'core', | ||
labels: ['Next Release'] | ||
}); | ||
const updated = await github.rest.issues.get({ | ||
issue_number: ${{ inputs.issue_number }}, | ||
owner: '${{ github.repository_owner }}', | ||
repo: 'core' | ||
}); | ||
console.log(`Labels: ${JSON.stringify(updated.data.labels, null, 2)}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
name: Post Issue Edited | ||
on: | ||
issues: | ||
types: [edited, labeled] | ||
types: [ edited, labeled ] | ||
|
||
jobs: | ||
frontend-notify: | ||
name: Issue Resolve Actions | ||
if: success() | ||
uses: ./.github/workflows/issue_comp_frontend-notify.yml | ||
secrets: | ||
CI_MACHINE_USER: ${{ secrets.CI_MACHINE_USER }} | ||
CI_MACHINE_TOKEN: ${{ secrets.CI_MACHINE_TOKEN }} | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
|
||
next-release-label-update: | ||
name: Next Release label update | ||
if: github.event.action == 'labeled' | ||
uses: ./.github/workflows/issue_comp_next-release-label.yml | ||
secrets: | ||
CI_MACHINE_TOKEN: ${{ secrets.CI_MACHINE_TOKEN }} |