issue-status-helper.yml 667 B

12345678910111213141516
  1. name: Issue Status Helper
  2. on:
  3. issues:
  4. types: [labeled]
  5. jobs:
  6. ensure_one_status:
  7. runs-on: ubuntu-latest
  8. if: "startsWith(github.event.label.name, 'Status: ')"
  9. steps:
  10. - name: "Ensure a single 'Status: *' label"
  11. env:
  12. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  13. GH_REPO: ${{ github.repository }}
  14. run: |
  15. labels_to_remove=$(gh api --paginate "/repos/$GH_REPO/labels" -q '[.[].name | select(startswith("Status: ") and . != "${{ github.event.label.name }}")] | join(",")')
  16. gh issue edit ${{ github.event.issue.number }} --remove-label "$labels_to_remove" --add-label "${{ github.event.label.name }}"