Skip to content

Commit 3bce9c8

Browse files
authored
Check out pull request HEAD commit?
1 parent 377f29e commit 3bce9c8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/Label.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ jobs:
88
- uses: actions/checkout@v6
99
with:
1010
submodules: recursive
11+
ref: ${{ github.event.pull_request.head.sha }} # Check out the pull request HEAD commit instead of the merge commit
1112
- name: If there are changes in PublicApi.Shipped.txt, fail the workflow
1213
if: github.head_ref != 'action/ship-publicapi' # Same branch name specified in Release.yml
1314
run: |
1415
git fetch origin ${{ github.base_ref }}
15-
$changes = git diff --numstat --shortstat origin/${{ github.base_ref }}...${{ github.sha }} -- '**/PublicApi.Shipped.txt'
16+
$changes = git diff --numstat --shortstat origin/${{ github.base_ref }}...HEAD -- '**/PublicApi.Shipped.txt'
1617
Write-Output "$changes"
1718
if ($changes) {
1819
Write-Error "Changes detected in PublicApi.Shipped.txt files. Public API changes must be shipped through the release process, not in regular pull requests."
@@ -29,7 +30,7 @@ jobs:
2930
Write-Output "This is a ship-publicapi PR, labeling as Type/Maintenance"
3031
} else {
3132
# For regular PRs, check for API changes
32-
$changes = git diff origin/${{ github.base_ref }}...${{ github.sha }} -- '**/PublicApi.Unshipped.txt'
33+
$changes = git diff origin/${{ github.base_ref }}...HEAD -- '**/PublicApi.Unshipped.txt'
3334
Write-Output "$changes"
3435
3536
if ($changes) {

0 commit comments

Comments
 (0)