1
0
mirror of synced 2026-01-05 12:07:35 -05:00

Add support for deleted files to get-changed-files (#54922)

This commit is contained in:
Hector Alfaro
2025-03-19 23:13:12 -04:00
committed by GitHub
parent ea328a6009
commit 2528bef7f7
6 changed files with 153 additions and 69 deletions

View File

@@ -35,7 +35,6 @@ jobs:
files: |
content/**
data/**
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print content linter annotations if changed content/data files
if: steps.changed_files.outputs.filtered_changed_files
@@ -50,7 +49,7 @@ jobs:
run: npm run lint-content -- --print-annotations --paths $CHANGED_FILES
- name: Run content linter if changed content/data files
if: steps.changed_files.outputs.any_changed == 'true'
if: steps.changed_files.outputs.filtered_changed_files
env:
# Make it an environment variable so that its value doesn't need to be escaped.
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

View File

@@ -39,7 +39,6 @@ jobs:
uses: ./.github/actions/get-changed-files
with:
files: 'content/**'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node and dependencies
if: steps.changed_files.outputs.filtered_changed_files

View File

@@ -28,9 +28,6 @@ jobs:
# Even if if doesn't do anything
- name: Check out repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# See https://github.com/tj-actions/changed-files#on-pull_request-
fetch-depth: 2
- uses: ./.github/actions/node-npm-setup
@@ -45,21 +42,13 @@ jobs:
run: npm run build
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4 # v45.0.0
id: changed_files
uses: ./.github/actions/get-changed-files
with:
# No need to escape the file names because we make the output of
# tj-actions/changed-files be set as an environment variable. Not
# as a direct input to the line of bash that uses it.
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
safe_output: false
files: 'content/**'
# Necessary so we can know what the old name was when a
# content file was renamed.
output_renamed_files_as_deleted_and_added: true
- name: Run tests
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.modified_files }}
DELETED_FILES: ${{ steps.changed-files.outputs.deleted_files }}
CHANGED_FILES: ${{ steps.changed_files.outputs.filtered_changed_files }}
DELETED_FILES: ${{ steps.changed_files.outputs.filtered_deleted_files }}
run: npm test -- src/content-render/tests/render-changed-and-deleted-files.js

View File

@@ -106,7 +106,6 @@ jobs:
with:
files: |
content/**
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate PR comment
if: ${{ github.event_name == 'pull_request' && steps.changed_files.outputs.filtered_changed_files }}