From 015975d33e9afba1a038d59f62cff486a3f986ed Mon Sep 17 00:00:00 2001 From: Isaiah Akorita Date: Thu, 31 Jul 2025 11:04:27 +0100 Subject: [PATCH] check type or label before auto apply triage --- .github/workflows/auto_triage.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto_triage.yml b/.github/workflows/auto_triage.yml index 835de65c0..53c7ffdbb 100644 --- a/.github/workflows/auto_triage.yml +++ b/.github/workflows/auto_triage.yml @@ -11,7 +11,28 @@ jobs: permissions: issues: write steps: - - run: gh issue edit "$NUMBER" --add-label "$LABELS" + - name: Check if issue needs triage + id: check-labels + run: | + # Get current labels - if any exist, the issue has been looked at + label_count=$(gh issue view "$NUMBER" --json labels --jq '.labels | length') + echo "Number of existing labels: $label_count" + + if [ "$label_count" -eq 0 ]; then + needs_triage=true + else + needs_triage=false + fi + + echo "needs_triage=$needs_triage" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + + - name: Add triage label + if: steps.check-labels.outputs.needs_triage == 'true' + run: gh issue edit "$NUMBER" --add-label "$LABELS" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }}