Skip to content

Commit ceb87d2

Browse files
authored
Bugfix/ci artifacts on forks (#89)
* Fix for PR runs on forks Do not deploy ci-artifacts for PRs coming from forks Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
1 parent 0aef59d commit ceb87d2

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/continuous_integration.yml

+22-1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ jobs:
220220
workflow_path: ${{ steps.set_workflow_path.outputs.workflow_path }}
221221
sha_everest_ci: ${{ steps.set_sha_everest_ci.outputs.sha }}
222222
tag_everest_ci: ${{ steps.set_tag_everest_ci.outputs.latest_tag }}
223+
is_fork: ${{ steps.is_fork.outputs.is_fork }}
223224
steps:
224225
- name: Determine workflow_path
225226
id: set_workflow_path
@@ -265,6 +266,24 @@ jobs:
265266
fi
266267
267268
echo "latest_tag=$TAG" >> $GITHUB_OUTPUT
269+
- name: Determine whether the PR comes from fork
270+
id: is_fork
271+
run: |
272+
if [ "${{ github.event_name }}" == "pull_request" ]; then
273+
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
274+
is_fork=true
275+
else
276+
is_fork=false
277+
fi
278+
else
279+
is_fork=false
280+
fi
281+
echo "is_fork=${is_fork}" >> $GITHUB_OUTPUT
282+
if [ "${is_fork}" == "true" ]; then
283+
echo "This is a forked PR"
284+
else
285+
echo "This is not a forked PR"
286+
fi
268287
269288
build-the-build-kit:
270289
name: Build build-kit
@@ -414,7 +433,7 @@ jobs:
414433
path: ${{ inputs.coverage_xml_path}}
415434
- name: Deploy html coverage report
416435
id: deploy_coverage_report
417-
if: ${{ steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' }}
436+
if: ${{ ( steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' ) && needs.setup-env.outputs.is_fork == 'false' }}
418437
uses: ./everest-ci/github-actions/deploy-ci-artifact
419438
with:
420439
target_repo: ${{ inputs.artifact_deploy_target_repo }}
@@ -571,6 +590,7 @@ jobs:
571590
anybadge -o --label Coverage --value ${{ steps.parse_coverage_report.outputs.line_coverage_percentage }} -s "%" --file ${{ github.workspace }}/coverage-badge/coverage-badge.svg 20=red 40=orange 60=yellow 80=yellowgreen 100=green
572591
- name: Deploy coverage badge
573592
uses: ./everest-ci/github-actions/deploy-ci-artifact
593+
if: ${{ needs.setup-env.outputs.is_fork == 'false' }}
574594
with:
575595
target_repo: ${{ inputs.artifact_deploy_target_repo }}
576596
github_token: ${{ secrets.coverage_deploy_token }}
@@ -585,6 +605,7 @@ jobs:
585605
path: coverage-report
586606
- name: Deploy html coverage report
587607
uses: ./everest-ci/github-actions/deploy-ci-artifact
608+
if: ${{ needs.setup-env.outputs.is_fork == 'false' }}
588609
with:
589610
target_repo: ${{ inputs.artifact_deploy_target_repo }}
590611
github_token: ${{ secrets.coverage_deploy_token }}

0 commit comments

Comments
 (0)