Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow maintainer to re-run integration tests for PRs from forks #811

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Integration Tests

on:
pull_request:
pull_request_target:
types:
- opened
- synchronize
- reopened
push:
branches:
- main
Expand Down Expand Up @@ -30,7 +35,26 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Fetch user permission
if: ${{ github.event_name == 'pull_request_target' }}
id: permission
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
- name: Check user permission
if: ${{ github.event_name == 'pull_request_target' && steps.permission.outputs.require-result == 'false' }}
# If the triggering actor does not have write permission (i.e., this is a
# PR from a fork), then we exit, otherwise most of the integration tests will
# fail because they require access to secrets. In this case, a maintainer
# will need to make sure the PR looks safe, and if so, manually re-run the
# failed jobs.
run: |
echo "User ${{ github.triggering_actor }} does not have permission to run integration tests."
echo "A maintainer must perform a security review and re-run this build, if the code is safe."
Comment on lines +53 to +54
Copy link
Collaborator

@mfisher87 mfisher87 Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "User ${{ github.triggering_actor }} does not have permission to run integration tests."
echo "A maintainer must perform a security review and re-run this build, if the code is safe."
echo "User ${{ github.triggering_actor }} does not have permission to run integration tests." | tee -a $GITHUB_OUTPUT
echo "A maintainer must perform a security review and re-run this build, if the code is safe (see https://securitylab.github.com/resources/github-actions-preventing-pwn-requests)." | tee -a $GITHUB_OUTPUT
echo "Re-run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | tee -a $GITHUB_OUTPUT

It'd be awesome to expose this at the GUI. Untested URL :)

exit 1
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
Loading