mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Re-enable link linter (#153280)
And make URL linter always succeed for now. I'll monitor the logs manually and experiment with it futher. Pull Request resolved: https://github.com/pytorch/pytorch/pull/153280 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
6f34d141ab
commit
3c0b93afc5
30
.github/workflows/_link_check.yml
vendored
30
.github/workflows/_link_check.yml
vendored
@ -7,29 +7,25 @@ on:
|
|||||||
ref:
|
ref:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
run-url-lint:
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-urls:
|
lint-urls:
|
||||||
if: ${{ inputs.run-url-lint }}
|
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'skip-url-lint') }}
|
||||||
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
|
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
|
||||||
with:
|
with:
|
||||||
timeout: 120
|
timeout: 120
|
||||||
runner: ${{ inputs.runner }}linux.2xlarge
|
runner: ${{ inputs.runner }}linux.2xlarge
|
||||||
docker-image: pytorch-linux-focal-linter
|
docker-image: ci-image:pytorch-linux-focal-linter
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: false
|
submodules: false
|
||||||
ref: ${{ inputs.ref }}
|
ref: ${{ inputs.ref }}
|
||||||
script: |
|
script: |
|
||||||
./scripts/lint_urls.sh $(
|
./scripts/lint_urls.sh $(
|
||||||
{ [ "${{ github.event_name }}" = "pull_request" ] \
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
&& git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"; } \
|
echo "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}"
|
||||||
|| \
|
else
|
||||||
{ [ "${{ github.event_name }}" = "push" ] \
|
echo "${{ github.event.before }}" "${{ github.sha }}"
|
||||||
&& git diff --name-only "${{ github.event.before }}...${{ github.sha }}"; }
|
fi
|
||||||
) || {
|
) || {
|
||||||
echo
|
echo
|
||||||
echo "URL lint failed."
|
echo "URL lint failed."
|
||||||
@ -44,17 +40,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
timeout: 60
|
timeout: 60
|
||||||
runner: ${{ inputs.runner }}linux.2xlarge
|
runner: ${{ inputs.runner }}linux.2xlarge
|
||||||
docker-image: pytorch-linux-focal-linter
|
docker-image: ci-image:pytorch-linux-focal-linter
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: false
|
submodules: false
|
||||||
ref: ${{ inputs.ref }}
|
ref: ${{ inputs.ref }}
|
||||||
script: |
|
script: |
|
||||||
./scripts/lint_xrefs.sh $(
|
./scripts/lint_xrefs.sh $(
|
||||||
{ [ "${{ github.event_name }}" = "pull_request" ] \
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
&& git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"; } \
|
echo "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}"
|
||||||
|| \
|
else
|
||||||
{ [ "${{ github.event_name }}" = "push" ] \
|
echo "${{ github.event.before }}" "${{ github.sha }}"
|
||||||
&& git diff --name-only "${{ github.event.before }}...${{ github.sha }}"; }
|
fi
|
||||||
) || {
|
) || {
|
||||||
echo
|
echo
|
||||||
echo "Xref lint failed."
|
echo "Xref lint failed."
|
||||||
|
9
.github/workflows/lint.yml
vendored
9
.github/workflows/lint.yml
vendored
@ -283,6 +283,15 @@ jobs:
|
|||||||
# All we need to see is that it passes
|
# All we need to see is that it passes
|
||||||
python3 torch/utils/collect_env.py
|
python3 torch/utils/collect_env.py
|
||||||
|
|
||||||
|
link-check:
|
||||||
|
name: Link checks
|
||||||
|
needs: get-label-type
|
||||||
|
uses: ./.github/workflows/_link_check.yml
|
||||||
|
with:
|
||||||
|
runner: ${{ needs.get-label-type.outputs.label-type }}
|
||||||
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
1
.github/workflows/nightly.yml
vendored
1
.github/workflows/nightly.yml
vendored
@ -34,7 +34,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
runner: ${{ needs.get-label-type.outputs.label-type }}
|
runner: ${{ needs.get-label-type.outputs.label-type }}
|
||||||
ref: ${{ github.sha }}
|
ref: ${{ github.sha }}
|
||||||
run-url-lint: true
|
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
docs-build:
|
docs-build:
|
||||||
|
@ -61,7 +61,7 @@ while IFS=: read -r filepath url; do
|
|||||||
while [ "$(running_jobs)" -ge "$max_jobs" ]; do
|
while [ "$(running_jobs)" -ge "$max_jobs" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
done < <(
|
done < <(
|
||||||
pattern='(?!.*@lint-ignore)(?<!git\+)(?<!\$\{)https?://(?![^/]*@)(?![^\s<>\")]*[<>\{\}\$])[^[:space:]<>")\[\]\\|]+'
|
pattern='(?!.*@lint-ignore)(?<!git\+)(?<!\$\{)https?://(?![^/]*@)(?![^\s<>\")]*[<>\{\}\$])[^[:space:]<>")\[\]\\|]+'
|
||||||
excludes=(
|
excludes=(
|
||||||
':(exclude,glob)**/.*'
|
':(exclude,glob)**/.*'
|
||||||
@ -73,12 +73,17 @@ while IFS=: read -r filepath url; do
|
|||||||
':(exclude,glob)**/third-party/**'
|
':(exclude,glob)**/third-party/**'
|
||||||
':(exclude,glob)**/third_party/**'
|
':(exclude,glob)**/third_party/**'
|
||||||
)
|
)
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
paths=("$@")
|
for filename in $(git diff --name-only --unified=0 "$1...$2"); do
|
||||||
|
git diff --unified=0 "$1...$2" -- "$filename" "${excludes[@]}" \
|
||||||
|
| grep -E '^\+' \
|
||||||
|
| grep -Ev '^\+\+\+' \
|
||||||
|
| perl -nle 'print for m#'"$pattern"'#g' \
|
||||||
|
| sed 's|^|'"$filename"':|'
|
||||||
|
done
|
||||||
else
|
else
|
||||||
paths=('*')
|
git --no-pager grep --no-color -I -P -o "$pattern" -- . "${excludes[@]}"
|
||||||
fi
|
fi \
|
||||||
git --no-pager grep --no-color -I -P -o "$pattern" -- "${paths[@]}" "${excludes[@]}" \
|
|
||||||
| sed -E 's/[^/[:alnum:]]+$//' \
|
| sed -E 's/[^/[:alnum:]]+$//' \
|
||||||
| grep -Ev '://(0\.0\.0\.0|127\.0\.0\.1|localhost)([:/])' \
|
| grep -Ev '://(0\.0\.0\.0|127\.0\.0\.1|localhost)([:/])' \
|
||||||
| grep -Ev '://[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' \
|
| grep -Ev '://[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' \
|
||||||
|
@ -29,12 +29,17 @@ done < <(
|
|||||||
':(exclude,glob)**/third-party/**'
|
':(exclude,glob)**/third-party/**'
|
||||||
':(exclude,glob)**/third_party/**'
|
':(exclude,glob)**/third_party/**'
|
||||||
)
|
)
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
paths=("$@")
|
for filename in $(git diff --name-only --unified=0 "$1...$2"); do
|
||||||
|
git diff --unified=0 "$1...$2" -- "$filename" "${excludes[@]}" \
|
||||||
|
| grep -E '^\+' \
|
||||||
|
| grep -Ev '^\+\+\+' \
|
||||||
|
| perl -nle 'print for m#'"$pattern"'#g' \
|
||||||
|
| sed 's|^|'"$filename"':|'
|
||||||
|
done
|
||||||
else
|
else
|
||||||
paths=('*')
|
git --no-pager grep --no-color -I -P -o "$pattern" -- . "${excludes[@]}"
|
||||||
fi
|
fi \
|
||||||
git --no-pager grep --no-color -I -P -o "$pattern" -- "${paths[@]}" "${excludes[@]}" \
|
|
||||||
| grep -Ev 'https?://' \
|
| grep -Ev 'https?://' \
|
||||||
| sed -E \
|
| sed -E \
|
||||||
-e 's#([^:]+):\[[^]]+\]\(([^)]+)\)#\1:\2#' \
|
-e 's#([^:]+):\[[^]]+\]\(([^)]+)\)#\1:\2#' \
|
||||||
|
Reference in New Issue
Block a user