Skip to content

Commit 34f8cd8

Browse files
committed
Remove the safe-to-test label automatically (#141)
*Issue #, if available:* *Description of changes:* Extract the fix in 3f073a4 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 0629ba4 commit 34f8cd8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/integration-tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches: ["main"]
77
pull_request_target:
8-
types: [opened, synchronize, reopened, ready_for_review, labeled]
8+
types: [labeled]
99

1010
env:
1111
CARGO_TERM_COLOR: always
@@ -26,8 +26,26 @@ jobs:
2626
permissions:
2727
id-token: write
2828
contents: read
29+
issues: write
30+
pull-requests: write
31+
32+
env:
33+
LABEL_NAME: safe-to-test
34+
REPO: ${{ github.event.pull_request.base.repo.full_name }}
35+
PR_NUMBER: ${{ github.event.pull_request.number }}
2936

3037
steps:
38+
- name: Remove label
39+
run: |
40+
echo "Removing label '$LABEL_NAME' from PR #$PR_NUMBER on repo $REPO"
41+
gh_status=$(gh api "repos/$REPO/issues/$PR_NUMBER/labels/$LABEL_NAME" -X DELETE | jq ".status" --raw-output)
42+
case $gh_status in
43+
200) echo "Label removed" ;;
44+
404) echo "Label not found — ignoring" ;;
45+
*) echo "unexpected HTTP $gh_status" && exit 1 ;;
46+
esac
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3149
- name: Checkout
3250
uses: actions/checkout@v5
3351
with:

0 commit comments

Comments
 (0)