File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ name: Validate Pull Request
55on :
66 pull_request :
77 branches : [main, "release/**"]
8- merge_group :
98
109# Cancels old running job if a new one is triggered (e.g. by a push onto the same branch).
1110# This will cancel dependent jobs as well, such as dep_rust and dep_fuzzing
@@ -23,22 +22,20 @@ jobs:
2322 outputs :
2423 docs-only : ${{ steps.docs-only.outputs.result }}
2524 steps :
26- - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
27- id : changes
28- with :
29- filters : |
30- docs:
31- - '**/*.md'
32- - '**/*.txt'
33- all:
34- - '**/*'
25+ # Determine whether a PR only touches docs (*.md / *.txt) so downstream
26+ # jobs can skip expensive work.
3527 - uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3628 id : docs-only
3729 with :
3830 script : |
39- let docs_file_count = ${{steps.changes.outputs.docs_count}};
40- let all_file_count = ${{steps.changes.outputs.all_count}};
41- return all_file_count === docs_file_count;
31+ const files = await github.paginate(github.rest.pulls.listFiles, {
32+ owner: context.repo.owner,
33+ repo: context.repo.repo,
34+ pull_number: context.payload.pull_request.number,
35+ per_page: 100,
36+ });
37+ const isDoc = f => /\.(md|txt)$/.test(f.filename);
38+ return files.length > 0 && files.every(isDoc);
4239 result-encoding : string
4340
4441 # Update guest Cargo.lock for Dependabot PRs.
You can’t perform that action at this time.
0 commit comments