Skip to content

Commit 4e32edb

Browse files
authored
Merge pull request #557 from netwrix/dev
use dynamic label check for content-fix jobs
2 parents 416e5e8 + 3414754 commit 4e32edb

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

.github/workflows/claude-issue-labeler.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ jobs:
102102
needs: process-issue
103103
if: >-
104104
github.event_name == 'issues' &&
105-
github.event.action == 'opened' &&
106-
contains(join(github.event.issue.labels.*.name, ','), 'documentation') &&
107-
contains(join(github.event.issue.labels.*.name, ','), 'fix')
105+
github.event.action == 'opened'
108106
runs-on: ubuntu-latest
109107
permissions:
110108
contents: write
@@ -113,22 +111,25 @@ jobs:
113111
id-token: write
114112

115113
steps:
116-
- name: Check if issue is still open
117-
id: check-state
114+
- name: Check issue state and labels
115+
id: check-issue
118116
run: |
119-
STATE=$(gh issue view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json state --jq .state)
117+
ISSUE_DATA=$(gh issue view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json state,labels)
118+
STATE=$(echo "$ISSUE_DATA" | jq -r '.state')
119+
HAS_CONTENT_FIX=$(echo "$ISSUE_DATA" | jq '[.labels[].name] | any(. == "content:fix")')
120120
echo "issue_state=$STATE" >> "$GITHUB_OUTPUT"
121+
echo "has_content_fix=$HAS_CONTENT_FIX" >> "$GITHUB_OUTPUT"
121122
env:
122123
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123124

124125
- name: Checkout repository
125-
if: steps.check-state.outputs.issue_state == 'OPEN'
126+
if: steps.check-issue.outputs.issue_state == 'OPEN' && steps.check-issue.outputs.has_content_fix == 'true'
126127
uses: actions/checkout@v4
127128
with:
128129
fetch-depth: 0
129130

130131
- name: Run content-fix skill
131-
if: steps.check-state.outputs.issue_state == 'OPEN'
132+
if: steps.check-issue.outputs.issue_state == 'OPEN' && steps.check-issue.outputs.has_content_fix == 'true'
132133
uses: anthropics/claude-code-action@v1
133134
env:
134135
REPO: ${{ github.repository }}
@@ -151,9 +152,7 @@ jobs:
151152
github.event_name == 'issue_comment' &&
152153
!github.event.issue.pull_request &&
153154
contains(github.event.comment.body, '@claude') &&
154-
!startsWith(github.event.comment.user.login, 'github-actions') &&
155-
contains(join(github.event.issue.labels.*.name, ','), 'documentation') &&
156-
contains(join(github.event.issue.labels.*.name, ','), 'fix')
155+
!startsWith(github.event.comment.user.login, 'github-actions')
157156
runs-on: ubuntu-latest
158157
permissions:
159158
contents: write
@@ -162,22 +161,25 @@ jobs:
162161
id-token: write
163162

164163
steps:
165-
- name: Check if issue is still open
166-
id: check-state
164+
- name: Check issue state and labels
165+
id: check-issue
167166
run: |
168-
STATE=$(gh issue view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json state --jq .state)
167+
ISSUE_DATA=$(gh issue view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json state,labels)
168+
STATE=$(echo "$ISSUE_DATA" | jq -r '.state')
169+
HAS_CONTENT_FIX=$(echo "$ISSUE_DATA" | jq '[.labels[].name] | any(. == "content:fix")')
169170
echo "issue_state=$STATE" >> "$GITHUB_OUTPUT"
171+
echo "has_content_fix=$HAS_CONTENT_FIX" >> "$GITHUB_OUTPUT"
170172
env:
171173
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172174

173175
- name: Checkout repository
174-
if: steps.check-state.outputs.issue_state == 'OPEN'
176+
if: steps.check-issue.outputs.issue_state == 'OPEN' && steps.check-issue.outputs.has_content_fix == 'true'
175177
uses: actions/checkout@v4
176178
with:
177179
fetch-depth: 0
178180

179181
- name: Run content-fix skill
180-
if: steps.check-state.outputs.issue_state == 'OPEN'
182+
if: steps.check-issue.outputs.issue_state == 'OPEN' && steps.check-issue.outputs.has_content_fix == 'true'
181183
uses: anthropics/claude-code-action@v1
182184
env:
183185
REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)