Skip to content

Commit

Permalink
Merge pull request #85 from SweepMe/improve-semilinear-script
Browse files Browse the repository at this point in the history
Use source commit hash instead of branch name to support PRs from forks
  • Loading branch information
fk3 authored Jul 17, 2024
2 parents 6d4a604 + e056430 commit eff6e5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/Check-SemilinearHistory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ Param(
[Parameter(Mandatory)]
[string]$targetBranch,
[Parameter(Mandatory)]
[string]$sourceBranch
[string]$commitSource
)

$ErrorActionPreference = 'Stop'

git fetch origin $targetBranch
$commitTarget = git rev-parse "origin/$targetBranch"
git fetch origin $sourceBranch
$commitSource = git rev-parse "origin/$sourceBranch"
git fetch origin $commitSource

# verify that source branch originates from the latest commit of the target branch
# (i.e. a fast-forward merge could be performed)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semilinear_history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Check Semilinear History
shell: pwsh
run: |
.\.github\Check-SemilinearHistory.ps1 -targetBranch ${{ github.base_ref }} -sourceBranch ${{ github.head_ref }}
.\.github\Check-SemilinearHistory.ps1 -targetBranch ${{ github.base_ref }} -commitSource ${{ github.event.pull_request.head.sha }}

0 comments on commit eff6e5a

Please sign in to comment.