Use three-dot diffs in URL and xref lint workflows (#152895)

Only run on the files actually modified in a PR, not every file touched on main since the branch point

Fixes #152884

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152895
Approved by: https://github.com/huydhn
This commit is contained in:
Anthony Shoumikhin 2025-05-06 01:33:49 +00:00 committed by PyTorch MergeBot
parent f097e83369
commit 1798b0db25

View File

@ -25,9 +25,9 @@ jobs:
script: |
./scripts/lint_urls.sh $(
[ "${{ github.event_name }}" = "pull_request" ] \
&& git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
&& git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} \
|| [ "${{ github.event_name }}" = "push" ] \
&& git diff --name-only ${{ github.event.before }} ${{ github.sha }}
&& git diff --name-only ${{ github.event.before }}...${{ github.sha }}
) || {
echo
echo "URL lint failed."
@ -50,7 +50,7 @@ jobs:
script: |
./scripts/lint_xrefs.sh $(
[ "${{ github.event_name }}" = "pull_request" ] \
&& git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
&& git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} \
|| [ "${{ github.event_name }}" = "push" ] \
&& git diff --name-only ${{ github.event.before }} ${{ github.sha }}
&& git diff --name-only ${{ github.event.before }}...${{ github.sha }}
)