Skip to content

Commit 1a36d61

Browse files
add label removal check
1 parent c1d78b1 commit 1a36d61

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/silabs-require-admin-action-check.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,21 @@ jobs:
3535
fi
3636
env:
3737
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
38+
39+
prevent-label-removal:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Prevent sl-require-admin-action label removal
43+
if: github.event.action == 'unlabeled'
44+
run: |
45+
PR_NUMBER=${{ github.event.pull_request.number }}
46+
REMOVED_LABEL=${{ github.event.label.name }}
47+
if [ "$REMOVED_LABEL" == "sl-require-admin-action" ]; then
48+
echo "The sl-require-admin-action label cannot be removed. Failing the job."
49+
gh pr comment $PR_NUMBER --repo ${{ github.repository }} --body "The sl-require-admin-action label cannot be removed once it has been added."
50+
exit 1
51+
else
52+
echo "A different label was removed. Passing the job."
53+
fi
54+
env:
55+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)