Skip to content

Commit

Permalink
Bugfix/ci artifacts on forks (#89)
Browse files Browse the repository at this point in the history
* Fix for PR runs on forks

Do not deploy ci-artifacts for PRs coming from forks

Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm authored Feb 17, 2025
1 parent 0aef59d commit ceb87d2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ jobs:
workflow_path: ${{ steps.set_workflow_path.outputs.workflow_path }}
sha_everest_ci: ${{ steps.set_sha_everest_ci.outputs.sha }}
tag_everest_ci: ${{ steps.set_tag_everest_ci.outputs.latest_tag }}
is_fork: ${{ steps.is_fork.outputs.is_fork }}
steps:
- name: Determine workflow_path
id: set_workflow_path
Expand Down Expand Up @@ -265,6 +266,24 @@ jobs:
fi
echo "latest_tag=$TAG" >> $GITHUB_OUTPUT
- name: Determine whether the PR comes from fork
id: is_fork
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
is_fork=true
else
is_fork=false
fi
else
is_fork=false
fi
echo "is_fork=${is_fork}" >> $GITHUB_OUTPUT
if [ "${is_fork}" == "true" ]; then
echo "This is a forked PR"
else
echo "This is not a forked PR"
fi
build-the-build-kit:
name: Build build-kit
Expand Down Expand Up @@ -414,7 +433,7 @@ jobs:
path: ${{ inputs.coverage_xml_path}}
- name: Deploy html coverage report
id: deploy_coverage_report
if: ${{ steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' }}
if: ${{ ( steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' ) && needs.setup-env.outputs.is_fork == 'false' }}
uses: ./everest-ci/github-actions/deploy-ci-artifact
with:
target_repo: ${{ inputs.artifact_deploy_target_repo }}
Expand Down Expand Up @@ -571,6 +590,7 @@ jobs:
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
- name: Deploy coverage badge
uses: ./everest-ci/github-actions/deploy-ci-artifact
if: ${{ needs.setup-env.outputs.is_fork == 'false' }}
with:
target_repo: ${{ inputs.artifact_deploy_target_repo }}
github_token: ${{ secrets.coverage_deploy_token }}
Expand All @@ -585,6 +605,7 @@ jobs:
path: coverage-report
- name: Deploy html coverage report
uses: ./everest-ci/github-actions/deploy-ci-artifact
if: ${{ needs.setup-env.outputs.is_fork == 'false' }}
with:
target_repo: ${{ inputs.artifact_deploy_target_repo }}
github_token: ${{ secrets.coverage_deploy_token }}
Expand Down

0 comments on commit ceb87d2

Please sign in to comment.