Skip to content

Commit b5ceee1

Browse files
shoumikhinHaiting Pu
authored andcommitted
Use three-dot diffs in URL and xref lint workflows (#10706)
1 parent a952f3e commit b5ceee1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/_link_check.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
lint-urls:
10+
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'skip-url-lint') }}
1011
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
1112
with:
1213
runner: linux.2xlarge
@@ -17,13 +18,15 @@ jobs:
1718
timeout: 90
1819
script: |
1920
./scripts/lint_urls.sh $(
20-
[ "${{ github.event_name }}" = "pull_request" ] \
21-
&& git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
22-
|| [ "${{ github.event_name }}" = "push" ] \
23-
&& git diff --name-only ${{ github.event.before }} ${{ github.sha }}
21+
{ [ "${{ github.event_name }}" = "pull_request" ] \
22+
&& git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"; } \
23+
|| \
24+
{ [ "${{ github.event_name }}" = "push" ] \
25+
&& git diff --name-only "${{ github.event.before }}...${{ github.sha }}"; }
2426
)
2527
2628
lint-xrefs:
29+
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'skip-xref-lint') }}
2730
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
2831
with:
2932
runner: linux.2xlarge
@@ -34,8 +37,9 @@ jobs:
3437
timeout: 90
3538
script: |
3639
./scripts/lint_xrefs.sh $(
37-
[ "${{ github.event_name }}" = "pull_request" ] \
38-
&& git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
39-
|| [ "${{ github.event_name }}" = "push" ] \
40-
&& git diff --name-only ${{ github.event.before }} ${{ github.sha }}
40+
{ [ "${{ github.event_name }}" = "pull_request" ] \
41+
&& git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"; } \
42+
|| \
43+
{ [ "${{ github.event_name }}" = "push" ] \
44+
&& git diff --name-only "${{ github.event.before }}...${{ github.sha }}"; }
4145
)

0 commit comments

Comments
 (0)