File size: 1,206 Bytes
57970d3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# Remove label "in-progress" when an issue is closed
name: Remove issue label
on:
issues:
types: [closed]
jobs:
remove_label:
runs-on: ubuntu-latest
steps:
- name: Remove label
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const labelToRemove = "in-progress";
// Fetch all labels for the issue
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
issue_number: issue_number,
owner: owner,
repo: repo
});
// Check if the label exists on the issue
const hasLabel = currentLabels.some(label => label.name === labelToRemove);
// If the label exists, remove it
if (hasLabel) {
await github.rest.issues.removeLabel({
issue_number: issue_number,
owner: owner,
repo: repo,
name: labelToRemove
});
}
|