Skip to content

Commit ed651ab

Browse files
akoclaude
andcommitted
fix: prevent duplicate enhancement guide runs per issue
When an issue is created with the 'enhancement' label, both the 'opened' and 'labeled' events fire, triggering the workflow twice. Fix with two layers: - concurrency group per issue number with cancel-in-progress - refined if condition: 'labeled' only triggers when the specific label added is 'enhancement', not for any label change Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9cc0921 commit ed651ab

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/ai-enhancement-guide.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ on:
44
issues:
55
types: [opened, labeled]
66

7+
concurrency:
8+
group: enhancement-guide-${{ github.event.issue.number }}
9+
cancel-in-progress: true
10+
711
permissions:
812
issues: write
913
contents: read
1014

1115
jobs:
1216
guide:
13-
# Only run for issues with 'enhancement' label
14-
if: contains(github.event.issue.labels.*.name, 'enhancement')
17+
# On 'opened': run if issue has 'enhancement' label
18+
# On 'labeled': run only if the label just added is 'enhancement'
19+
if: >-
20+
(github.event.action == 'opened' && contains(github.event.issue.labels.*.name, 'enhancement'))
21+
|| (github.event.action == 'labeled' && github.event.label.name == 'enhancement')
1522
runs-on: ubuntu-latest
1623
steps:
1724
- uses: actions/checkout@v5

0 commit comments

Comments
 (0)