Skip to content

Commit

Permalink
#29618: adding new Github worflow to automate the 'Next Release' lab…
Browse files Browse the repository at this point in the history
…eling.
  • Loading branch information
victoralfaro-dotcms committed Aug 31, 2024
1 parent f9eb9a3 commit b365d23
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 2 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/issue_comp_next-release-label.yml
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)}`);
10 changes: 8 additions & 2 deletions .github/workflows/issue_on-change_post-issue-edited.yml
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 }}

0 comments on commit b365d23

Please sign in to comment.