Skip to content

Commit 087b394

Browse files
committed
github actions: Skip JIRA checks for forks
There are many workflows that are useful without the JIRA checks from Forks. We're still evaluating how to best deal with this without a lot of engineer overhead to check external contributors.
1 parent 3026731 commit 087b394

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/validate-kernel-commits.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,30 @@ jobs:
152152
exit 1
153153
fi
154154
155+
- name: Determine if JIRA PR check should run
156+
id: should_check_jira
157+
run: |
158+
if [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.repository }}" ]; then
159+
echo "result=true" >> $GITHUB_OUTPUT
160+
else
161+
echo "result=false" >> $GITHUB_OUTPUT
162+
fi
163+
155164
- name: Install JIRA PR Check dependencies
165+
if: steps.should_check_jira.outputs.result == 'true'
156166
run: |
157167
python -m pip install --upgrade pip
158168
pip install jira
159169
160170
- name: Mask JIRA credentials
171+
if: steps.should_check_jira.outputs.result == 'true'
161172
run: |
162173
echo "::add-mask::${{ secrets.JIRA_API_TOKEN }}"
163174
echo "::add-mask::${{ secrets.JIRA_API_USER }}"
164175
echo "::add-mask::${{ secrets.JIRA_URL }}"
165176
166177
- name: Run JIRA PR Check
178+
if: steps.should_check_jira.outputs.result == 'true'
167179
id: jira_check
168180
continue-on-error: true # Allow PR comments to be posted before failing workflow
169181
env:
@@ -213,7 +225,7 @@ jobs:
213225
exit $EXIT_CODE
214226
215227
- name: Comment PR with JIRA issues
216-
if: steps.jira_check.outputs.has_issues == 'true'
228+
if: steps.should_check_jira.outputs.result == 'true' && steps.jira_check.outputs.has_issues == 'true'
217229
env:
218230
GH_TOKEN: ${{ github.token }}
219231
run: |
@@ -225,7 +237,7 @@ jobs:
225237
fi
226238
227239
- name: Request changes if LTS mismatch
228-
if: steps.jira_check.outputs.has_lts_mismatch == 'true'
240+
if: steps.should_check_jira.outputs.result == 'true' && steps.jira_check.outputs.has_lts_mismatch == 'true'
229241
env:
230242
GH_TOKEN: ${{ github.token }}
231243
run: |
@@ -235,7 +247,7 @@ jobs:
235247
--repo "${{ github.repository }}"
236248
237249
- name: Fail workflow if JIRA errors found
238-
if: steps.jira_check.outcome == 'failure'
250+
if: steps.should_check_jira.outputs.result == 'true' && steps.jira_check.outcome == 'failure'
239251
run: |
240252
echo "❌ JIRA PR check failed - errors were found in one or more commits"
241253
exit 1

0 commit comments

Comments
 (0)