Skip to content

Commit

Permalink
ci: Refactor linear-history check to run on pull request target for c…
Browse files Browse the repository at this point in the history
…ommunity PRs
  • Loading branch information
AaronFriel committed Nov 15, 2022
1 parent 972e1e8 commit 22d83d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/on-pr-target.yml
@@ -0,0 +1,26 @@
name: PR

# This workflow should be used with care. pull_request_target runs on untrusted workflows
# with potential write access. We disable all but "contents: read" here.
#
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests
on:
pull_request_target:

permissions:
contents: read

jobs:
# This check enables us to ensure PRs have valid commit history or recommend a corrective action
# before running `bors`.
linear-history:
name: linear-history
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# This should be the merge commit of the PR or candidate merge commit in the staging branch for `bors`.
ref: refs/pull/${{ github.event.pull_request.number }}/merge
fetch-depth: 0
- name: Check for non-linear history
run: ./scripts/git-linear-history-check.sh
2 changes: 1 addition & 1 deletion bors.toml
Expand Up @@ -7,5 +7,5 @@ status = [
'bors-ok',
]
pr_status = [
'CI / lint / linear-history'
'PR / linear-history'
]

0 comments on commit 22d83d9

Please sign in to comment.