Skip to content

Commit 2b11c5c

Browse files
heiskrCopilot
andauthored
Replace custom get-changed-files action with tj-actions/changed-files (#60111)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c7828b1 commit 2b11c5c

File tree

9 files changed

+29
-282
lines changed

9 files changed

+29
-282
lines changed

.github/actions/get-changed-files/action.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/actions/get-changed-files/get-changed-files.sh

Lines changed: 0 additions & 204 deletions
This file was deleted.

.github/workflows/content-lint-markdown.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,23 @@ jobs:
3030

3131
- name: Get changed content/data files
3232
id: changed_files
33-
uses: ./.github/actions/get-changed-files
33+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
3434
with:
3535
files: |
3636
content/**
3737
data/**
3838
3939
- name: Print content linter annotations if changed content/data files
40-
if: steps.changed_files.outputs.filtered_changed_files
40+
if: steps.changed_files.outputs.any_modified == 'true'
4141
env:
42-
# Make it an environment variable so that its value doesn't need to be escaped.
43-
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
44-
CHANGED_FILES: |-
45-
${{ steps.changed_files.outputs.filtered_changed_files }}
42+
CHANGED_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
4643
# If there are errors, using `--print-annotations` will make it
4744
# so it does *not* exit non-zero.
4845
# This is so that all warnings and errors are printed.
4946
run: npm run lint-content -- --print-annotations --paths $CHANGED_FILES
5047

5148
- name: Run content linter if changed content/data files
52-
if: steps.changed_files.outputs.filtered_changed_files
49+
if: steps.changed_files.outputs.any_modified == 'true'
5350
env:
54-
# Make it an environment variable so that its value doesn't need to be escaped.
55-
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
56-
CHANGED_FILES: |-
57-
${{ steps.changed_files.outputs.filtered_changed_files }}
51+
CHANGED_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
5852
run: npm run lint-content -- --errors-only --paths $CHANGED_FILES

.github/workflows/link-check-on-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Get changed files
4242
id: changed-files
43-
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v45
43+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
4444
with:
4545
files: |
4646
content/**/*.md

.github/workflows/readability.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,25 @@ jobs:
4848

4949
- name: Get changed content files
5050
id: changed_files
51-
uses: ./.github/actions/get-changed-files
51+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
5252
with:
5353
files: 'content/**/*.md'
54-
# For workflow_dispatch, compare against main
55-
base: ${{ github.event_name == 'workflow_dispatch' && 'main' || '' }}
5654

5755
- name: Disable Next.js telemetry
5856
run: npx next telemetry disable
5957

6058
- name: Start server in the background
61-
if: ${{ steps.changed_files.outputs.filtered_changed_files }}
59+
if: steps.changed_files.outputs.any_modified == 'true'
6260
run: npm start > /tmp/stdout.log 2> /tmp/stderr.log &
6361

6462
- name: Run readability analysis
65-
if: ${{ steps.changed_files.outputs.filtered_changed_files }}
63+
if: steps.changed_files.outputs.any_modified == 'true'
6664
env:
67-
CHANGED_FILES: ${{ steps.changed_files.outputs.filtered_changed_files }}
65+
CHANGED_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
6866
run: npm run readability-report
6967

7068
- name: Find existing readability comment
71-
if: ${{ steps.changed_files.outputs.filtered_changed_files }}
69+
if: steps.changed_files.outputs.any_modified == 'true'
7270
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad
7371
id: findComment
7472
with:
@@ -77,7 +75,7 @@ jobs:
7775
body-includes: '<!-- READABILITY_REPORT -->'
7876

7977
- name: Read readability report
80-
if: ${{ steps.changed_files.outputs.filtered_changed_files }}
78+
if: steps.changed_files.outputs.any_modified == 'true'
8179
id: read_report
8280
run: |
8381
if [ -f "readability-report.md" ]; then
@@ -89,7 +87,7 @@ jobs:
8987
fi
9088
9189
- name: Create or update readability comment
92-
if: ${{ steps.changed_files.outputs.filtered_changed_files && steps.read_report.outputs.report }}
90+
if: steps.changed_files.outputs.any_modified == 'true' && steps.read_report.outputs.report
9391
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
9492
with:
9593
comment-id: ${{ steps.findComment.outputs.comment-id }}

.github/workflows/reviewers-legal.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ jobs:
3636

3737
- name: Get changed files
3838
id: changed_files
39-
uses: ./.github/actions/get-changed-files
39+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
4040
with:
4141
files: 'content/**'
4242

4343
- name: Set up Node and dependencies
44-
if: steps.changed_files.outputs.filtered_changed_files
44+
if: steps.changed_files.outputs.any_modified == 'true'
4545
uses: ./.github/actions/node-npm-setup
4646

4747
- name: Check content type
48-
if: steps.changed_files.outputs.filtered_changed_files
48+
if: steps.changed_files.outputs.any_modified == 'true'
4949
id: checkContentType
5050
run: npm run check-content-type
5151
env:
52-
CHANGED_FILE_PATHS: ${{ steps.changed_files.outputs.filtered_changed_files }}
52+
CHANGED_FILE_PATHS: ${{ steps.changed_files.outputs.all_modified_files }}
5353
CONTENT_TYPE: 'rai'
5454

5555
- name: Add legal as a reviewer

.github/workflows/test-changed-content.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343

4444
- name: Get changed files
4545
id: changed_files
46-
uses: ./.github/actions/get-changed-files
46+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
4747
with:
4848
files: 'content/**'
4949

5050
- name: Run tests
5151
env:
52-
CHANGED_FILES: ${{ steps.changed_files.outputs.filtered_changed_files }}
53-
DELETED_FILES: ${{ steps.changed_files.outputs.filtered_deleted_files }}
52+
CHANGED_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
53+
DELETED_FILES: ${{ steps.changed_files.outputs.deleted_files }}
5454
run: npm test -- src/content-render/tests/render-changed-and-deleted-files.ts

.github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ jobs:
126126

127127
- name: Gather files changed
128128
if: ${{ matrix.name == 'content-linter' }}
129-
uses: ./.github/actions/get-changed-files
130-
with:
131-
head: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
132-
output_file: get_diff_files.txt
129+
id: changed_files
130+
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
131+
132+
- name: Write changed files to diff file
133+
if: ${{ matrix.name == 'content-linter' }}
134+
run: echo "${{ steps.changed_files.outputs.all_modified_files }}" > get_diff_files.txt
133135

134136
- uses: ./.github/actions/cache-nextjs
135137

0 commit comments

Comments
 (0)