1- # Triggers CodeRabbit's plan feature when a difficulty label is added to an issue.
2- # Only fires for skill: beginner/intermediate/advanced labels, preventing duplicate runs.
1+ # Triggers CodeRabbit's plan feature for difficulty-labeled issues.
2+ # It runs when a difficulty label is added to an unlocked issue, and again when
3+ # a previously locked issue is unlocked (e.g. after triage approval).
34name : CodeRabbit Plan Trigger
45on :
56 issues :
6- types : [labeled]
7+ types : [labeled, unlocked ]
78
89permissions :
910 issues : write
@@ -15,22 +16,50 @@ jobs:
1516 concurrency :
1617 group : coderabbit-plan-${{ github.event.issue.number }}
1718 cancel-in-progress : false
18- # Only run when the newly added label is a difficulty label (skill: beginner/intermediate/advanced)
19- if : >
20- github.event.action == 'labeled' &&
21- github.event.issue.state == 'open' &&
22- contains(fromJson('["skill: beginner","skill: intermediate","skill: advanced"]'), github.event.label.name)
2319
2420 steps :
2521 - name : Harden the runner
2622 uses : step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
2723 with :
2824 egress-policy : audit
2925
26+ - name : Evaluate trigger conditions
27+ id : should_run
28+ run : echo "value=true" >> "$GITHUB_OUTPUT"
29+ # Run only for open, unlocked issues that have beginner/intermediate/advanced difficulty.
30+ if : >
31+ github.event.issue.state == 'open' &&
32+ github.event.issue.locked == false &&
33+ (
34+ (
35+ github.event.action == 'labeled' &&
36+ contains(fromJson('["skill: beginner","skill: intermediate","skill: advanced"]'), github.event.label.name)
37+ ) ||
38+ (
39+ github.event.action == 'unlocked' &&
40+ (
41+ contains(github.event.issue.labels.*.name, 'skill: beginner') ||
42+ contains(github.event.issue.labels.*.name, 'skill: intermediate') ||
43+ contains(github.event.issue.labels.*.name, 'skill: advanced')
44+ )
45+ )
46+ )
47+
48+ - name : Log skip context
49+ if : steps.should_run.outputs.value != 'true'
50+ run : |
51+ echo "::notice::Skipping CodeRabbit plan trigger"
52+ echo "::notice::action=${{ github.event.action }}"
53+ echo "::notice::issue_state=${{ github.event.issue.state }}"
54+ echo "::notice::issue_locked=${{ github.event.issue.locked }}"
55+ echo "::notice::issue_labels=${{ join(github.event.issue.labels.*.name, ', ') }}"
56+
3057 - name : Checkout repository
58+ if : steps.should_run.outputs.value == 'true'
3159 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
3260
3361 - name : Trigger CodeRabbit Plan
62+ if : steps.should_run.outputs.value == 'true'
3463 env :
3564 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3665 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
0 commit comments