Skip to content

Commit 7012adf

Browse files
authored
Fix Labeller?
1 parent 4f8f330 commit 7012adf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/Label.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ jobs:
88
pull-requests: write # allow adding a label to this pull request
99
steps:
1010
- uses: actions/checkout@v6
11+
with:
12+
fetch-depth: 0 # fetch all commit history and tags, instead of the default fetch of only one commit
13+
ref: ${{ github.event.pull_request.head.sha }} # checkout the PR branch
1114
- name: If there are changes in PublicApi.Shipped.txt, fail the workflow
1215
if: github.head_ref != 'action/ship-publicapi' # Same branch name specified in Release.yml
1316
run: |
14-
$head = git rev-parse HEAD
15-
Write-Output "HEAD is $head"
16-
$changes = git diff --numstat --shortstat HEAD..${{ github.sha }} -- '**/PublicApi.Shipped.txt'
17+
$changes = git diff --numstat --shortstat origin/${{ github.base_ref }}...HEAD -- '**/PublicApi.Shipped.txt'
1718
Write-Output "$changes"
1819
if ($changes) {
1920
Write-Error "Changes detected in PublicApi.Shipped.txt files. Public API changes must be shipped through the release process, not in regular pull requests."
@@ -22,13 +23,12 @@ jobs:
2223
shell: pwsh
2324
- name: Label based on PublicApi.Unshipped.txt
2425
run: |
25-
# Determine the appropriate label (Sync these labels with release-drafter.yml)
26-
if ("${{ github.ref }}" -eq "action/ship-publicapi") { # Same branch name specified in Release.yml
26+
if ("${{ github.head_ref }}" -eq "action/ship-publicapi") {
2727
$labels = @('Type/Housekeeping')
2828
Write-Output "This is a ship-publicapi PR, labeling as Type/Maintenance"
2929
} else {
3030
# For regular PRs, check for API changes
31-
$changes = git diff HEAD..${{ github.sha }} -- '**/PublicApi.Unshipped.txt'
31+
$changes = git diff origin/${{ github.base_ref }}...HEAD -- '**/PublicApi.Unshipped.txt'
3232
Write-Output "$changes"
3333
3434
if ($changes) {

0 commit comments

Comments
 (0)