1
0
mirror of synced 2026-01-08 12:01:53 -05:00

Create update-status-labels-on-tracking-issues.yml (#19373)

* Create update-status-labels-on-tracking-issues.yml

* Lint

Co-authored-by: chiedo <chiedo@users.noreply.github.com>
This commit is contained in:
Chiedo John
2021-05-17 14:50:57 -04:00
committed by GitHub
parent 5aca388baa
commit da31de2a82

View File

@@ -0,0 +1,46 @@
name: Automatically Keep Epic Status Labels Updated
on:
issue_comment:
types: [created, edited]
jobs:
post-status-updates-to-slack:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '_created with') && contains(github.event.comment.body, 'typing_ `/status`')
steps:
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue
const owner = context.repo.owner
const repo = context.payload.repository.name
const allStatusLabels = [
'Status: GREEN',
'Status: GREY',
'Status: YELLOW',
'Status: BLACK',
'Status: RED'
];
const currentLabels = await github.issues.listLabelsOnIssue({
owner: owner,
repo: repo,
issue_number: issue.number
});
const newLabels = currentLabels.data.filter( label => allStatusLabels.includes(label.name) === false)
allStatusLabels.forEach( label => {
if(context.payload.comment.body.includes(label)) {
newLabels.push(label)
}
});
await github.issues.update({
owner: owner,
repo: repo,
issue_number: issue.number,
labels: newLabels,
});