Skip to content

Commit 58674f3

Browse files
committed
update broken link script to check the existing labels
1 parent 9da3aba commit 58674f3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/link-checker.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ jobs:
4343
- name: Determine label based on branch
4444
if: always()
4545
id: label
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4648
run: |
4749
LABEL_NAME="broken-link-${{ matrix.branch }}"
48-
if ! gh label list | grep -q "^${LABEL_NAME}\b"; then
49-
gh label create "${LABEL_NAME}" --description "Indicates broken links in branch ${{ matrix.branch }}"
50+
if gh label list -L 1000 | grep -q "^${LABEL_NAME}\b"; then
51+
echo "Label ${LABEL_NAME} already exists"
52+
else
53+
echo "Creating label ${LABEL_NAME}"
54+
gh label create "${LABEL_NAME}" \
55+
--description "Indicates broken links in branch ${{ matrix.branch }}"
5056
fi
51-
echo "label=$LABEL_NAME" >> $GITHUB_OUTPUT
57+
echo "label=$LABEL_NAME" >> $GITHUB_OUTPU
5258
5359
- name: Create GitHub issue if tests fail
5460
if: failure()

0 commit comments

Comments
 (0)