Skip to content

Commit 10f5b1c

Browse files
only post comment once for the label removal
1 parent 1a36d61 commit 10f5b1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ jobs:
4646
REMOVED_LABEL=${{ github.event.label.name }}
4747
if [ "$REMOVED_LABEL" == "sl-require-admin-action" ]; then
4848
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."
49+
COMMENTS=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json comments --jq '.comments[].body')
50+
if ! echo "$COMMENTS" | grep -q "The sl-require-admin-action label cannot be removed once it has been added."; then
51+
gh pr comment $PR_NUMBER --repo ${{ github.repository }} --body "The sl-require-admin-action label cannot be removed once it has been added."
52+
fi
5053
exit 1
5154
else
5255
echo "A different label was removed. Passing the job."

0 commit comments

Comments
 (0)