11# 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).
2+ # It runs when a difficulty label is added to an unlocked issue.
43name : CodeRabbit Plan Trigger
54on :
65 issues :
7- types : [labeled, unlocked ]
6+ types : [labeled]
87
98permissions :
109 issues : write
@@ -16,50 +15,24 @@ jobs:
1615 concurrency :
1716 group : coderabbit-plan-${{ github.event.issue.number }}
1817 cancel-in-progress : false
18+ # Run only for open, unlocked issues when a difficulty label is added.
19+ if : >
20+ github.event.issue.state == 'open' &&
21+ github.event.issue.locked == false &&
22+ contains(fromJson('["skill: beginner","skill: intermediate","skill: advanced"]'), github.event.label.name)
1923
2024 steps :
2125 - name : Harden the runner
2226 uses : step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
2327 with :
2428 egress-policy : audit
2529
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-
5730 - name : Checkout repository
58- if : steps.should_run.outputs.value == 'true'
5931 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
32+ with :
33+ persist-credentials : false
6034
6135 - name : Trigger CodeRabbit Plan
62- if : steps.should_run.outputs.value == 'true'
6336 env :
6437 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6538 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
0 commit comments