tj-actions / changed-files Goto Github PK
View Code? Open in Web Editor NEW:octocat: Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
License: MIT License
:octocat: Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
License: MIT License
In order to test for changes of any kind (create, edit, rename, delete), a combination of 2 conditions is required, like:
if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' || steps.changed-files-specific.outputs.any_deleted == 'true' }}
This works well, but it's a bit too long and could be simplified into a single expression.
If possible, add 2 new outputs any_touched
or all_touched
which let the user check for any type of modification to the repository contents. Something like:
if: ${{ steps.changed-files-specific.outputs.any_touched == 'true' }}
Using two conditions with an OR operator, as described in the beginning.
Gitlab CI's only:changes
clause behaves similarly to what I'm requesting.
An example of why these variables might be useful is when running test jobs. If the commit only has changes to the README, test jobs could be skipped since no .py
files were touched.
We use changed-files in one of our github workflows. It's basically triggered on pull_request merge. Snippet of code:
on:
pull_request:
types: [closed]
paths:
- 'abc/def/**'
jobs:
Publish-Pipelines:
if: github.event.pull_request.merged == true
......
However, in one of our PR merge event, I found the workflow failed with following info:
changed-files
Resolving repository path...
Setting up 'temp_changed_files' remote...
No 'temp_changed_files' remote found
Creating 'temp_changed_files' remote...
Getting HEAD info...
remote: Enumerating objects: 23, done.
remote: Counting objects: 4% (1/23)
remote: Counting objects: 8% (2/23)
remote: Counting objects: 13% (3/23)
remote: Counting objects: 17% (4/23)
remote: Counting objects: 21% (5/23)
remote: Counting objects: 26% (6/23)
remote: Counting objects: 30% (7/23)
remote: Counting objects: 34% (8/23)
remote: Counting objects: 39% (9/23)
remote: Counting objects: 43% (10/23)
remote: Counting objects: 47% (11/23)
remote: Counting objects: 52% (12/23)
remote: Counting objects: 56% (13/23)
remote: Counting objects: 60% (14/23)
remote: Counting objects: 65% (15/23)
remote: Counting objects: 69% (16/23)
remote: Counting objects: 73% (17/23)
remote: Counting objects: 78% (18/23)
remote: Counting objects: 82% (19/23)
remote: Counting objects: 86% (20/23)
remote: Counting objects: 91% (21/23)
remote: Counting objects: 95% (22/23)
remote: Counting objects: 100% (23/23)
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 25% (1/4)
remote: Compressing objects: 50% (2/4)
remote: Compressing objects: 75% (3/4)
remote: Compressing objects: 100% (4/4)
remote: Compressing objects: 100% (4/4), done.
remote: Total 12 (delta 8), reused 9 (delta 6), pack-reused 0
From https://github.com/instacart/carrot
! [rejected] master -> master (non-fast-forward)
* [new branch] master -> temp_changed_files/master
Error: Process completed with exit code 1.
I am wondering what may be the issue? The only thing I can think of is that, the PR was uploaded 8 days ago and merged today, which was the long time span. Would that cause any issue?
See bug description
ubuntu-latest or ubuntu-20.04
Workflow should go through
No response
No response
When using this action errors from non existing commits don’t result in a failure.
See: #253
Any commit that doesn’t exist locally warns the users with a possible resolution
No response
No response
I would expect any_changed to be true when there is a deleted file. It looks like any changed doesn't take deleted files into account.
Delete a file in the specified directory and then check the any_changed flag.
ubuntu-latest or ubuntu-20.04
If there is anything listed for "All changed files" that the any_changed flag would be true.
Checking for file changes: "automated-testing-gaps.md"...
Checking for file changes: "AutomatedTests"...
Added files:
Copied files:
Deleted files: AutomatedTests/SettingsMonitorTests.swift
Modified files:
Renamed files:
Type Changed files:
Unmerged files:
Unknown files:
All changed files: ffm/AutomatedTests/SettingsMonitorTests.swift
All modified files:
Input files: automated-testing-gaps.md AutomatedTests
Matching modified files:
Non Matching modified files: UserPreferences.m AppDelegate.m
No response
Given that both files and directories can be added using the files
input which seems limited to describing files.
Proposed change here would be renaming files
to paths
which is more generic and can describe both file based paths and directories.
No response
No response
The readme currently contains:
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/[email protected]
with:
files: |
my-file.txt
test.txt
new.txt
test_directory
*.sh
.(png|jpeg)$
.(sql)$
^(mynewfile|custom)
These examples are utilizing behavior undefined in the ERE
The asterisk, plus-sign, question-mark, and left-brace shall be special except when used in a bracket expression (see RE Bracket Expression). Any of the following uses produce undefined results:
If these characters appear first in an ERE, or immediately following an unescaped vertical-line, circumflex, dollar-sign, or left-parenthesis
GNU Grep allows them to be a part of EREs, but this can cause issues when it's used by other parts of the entrypoint script.
Given a directory structure such as
├── directory
│ └── child_dir.sh
└── root_dir.sh
and an action such as
- name: get changed files
id: changed_files
uses: tj-actions/[email protected]
with:
files: |
*.sh
output shows *.sh
gets expanded by the bash entrypoint script as a glob:
[...]
Checking for file changes: "root_dir.sh"...
[...]
Matching modified files:
Non Matching modified files: root_dir.sh directory/child_dir.sh
as opposed to the expected
[...]
Checking for file changes: "*.sh"...
[...]
Matching modified files: root_dir.sh directory/child_dir.sh
Non Matching modified files:
ubuntu-latest or ubuntu-20.04
If *.sh is in the examples, it should work to find any files with .sh in them. If not, it should be removed from the examples along with .
Variables with expected special characters should be quoted to prevent globbing when using them in output.
No response
For the *.sh
example, .*\.sh
works as a replacement.
https://www.gnu.org/software/grep/manual/html_node/Basic-vs-Extended.html
Tracking issue for:
This action would be more intuitive and easier to use if it supported the same file filtering syntax as GitHub Workflows support natively. I realize the reason it does not is because it's easier to just accept the input that is used natively by the underlying bash commands. But I'm curious if this is something that could eventually be implemented.
Use syntax like foo/**/bar
instead of ^foo/.*/bar
, or **/*.md
instead of or \.md$
. Exclusion rules could either be supported with !
rules, or in a separate input (e.g. exclude-files
).
No response
Using this on a monorepo with a lot of tags, it will cause minor slowness and more output over time (there are already hundreds of tags).
Tags don't seem to be necessary, so fetching can most likely be performed with --no-tags
.
https://github.com/tj-actions/changed-files/blob/main/entrypoint.sh#L52
No response
No response
I can't tell the difference between all_changed_files
and all_modified_files
.
I would love it if the two were clearly distinguished in the documentation.
No response
No response
Is your feature request related to a problem? Please describe.
Clean up tasks. which should resolve any confusion with changed vs modified.
Describe the solution you'd like
All references to changed_files
are modified to type_changed_files
.
Hi guys!
I have a Step with a lot of entries in files:
input and those entries often change. Since I already have an existing file with all files that could change (one for line), is there the possibility to provide this specific file to read from?
An example of implementation:
source file files-list.txt
:
my-file.txt
test.txt
new.txt
test_directory
.(png|jpeg)$
.(sql)$
^(mynewfile|custom)
Action step:
- name: Get specific changed files from a file
id: changed-files-specific
uses: tj-actions/[email protected]
with:
read-from-file: files-list.txt
No response
No response
Is it possible to add support for push commits?
i think it would be even more useful
Is your feature request related to a problem? Please describe.
I want to check if the file that's changed is in a specific directory.
Describe the solution you'd like
with:
show_file_path: true
Describe alternatives you've considered
I could do git status
and check within a run:
block, but it seems like it would fit bettere as part of this action
Additional context
Sample output:
{
added_files: Dockerfile src/components/Modal.jsx
...
}
I would expect any_changed to be true when there is a renamed file. It looks like any changed doesn't take renamed files into account.
Rename a file in the specified directory and then check the any_changed flag.
For the specific case when I came across this, the file was renamed (moved from a directory outside the one specified into the specified AutomatedTests directory) but also had additional changes. It only showed up in the renamed files list.
ubuntu-latest or ubuntu-20.04
If there is anything listed for "All changed files" that the any_changed flag would be true.
Checking for file changes: "AutomatedTests"...
Added files:
Copied files:
Deleted files:
Modified files:
Renamed files: AutomatedTests/DownloadDatabaseTestCase.swift
Type Changed files:
Unmerged files:
Unknown files:
All changed files: AutomatedTests/DownloadDatabaseTestCase.swift
All modified files:
Input files: AutomatedTests
Matching modified files:
No response
Is your feature request related to a problem? Please describe.
I am looking for a way to use the latest version of a specific major version in my pipeline. I would like to use the latest v5 version but comparing the latest commit hashes of v5.3 and v5, I see that these currently does not match.
Describe the solution you'd like
It would be helpful if we can specify tj-actions/changed-files@v5 or tj-actions/[email protected] to mean to use latest v5 branch.
Describe alternatives you've considered
I am currently using tj-actions/changed-files@v5 in my action and only hope it gets pointed to the latest release.
Additional context
None
The examples are hard to follow and understand
I'll like a more detailed example that highlights each use case.
No response
No response
The current action seems to just find changed files in the last commit. If a push includes multiple commits, then changed files in all but the last commit will be ignored.
The ability to list all changed files in all commits in a push that triggers the action.
No response
No response
i want only python files to be captured and using above format which doesnt work and giving below error.
fatal: bad object
i want only python files to be captured and using above format which doesnt work and giving below error.
fatal: bad object
ubuntu-18.04
only python files should come in the output
No response
No response
When running this action with act
(medium image) and providing a files
input, the full list of modified files is returned rather than the a filtered list.
act
name: Test
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changes
id: changes
uses: tj-actions/[email protected]
with:
files: \.yaml$
- name: Show changes
shell: bash
run: |
set -euo pipefail
for file in ${{ steps.changes.outputs.all_modified_files }}
do
echo "${file}"
done
ubuntu-latest or ubuntu-20.04
The same output should happen with act
and on GitHub.
No response
No response
Hello, due to a recent update this broke one of my CI pipelines. It appears in version 1.1.4 and 1.1.1 you included a breaking change. Please follow semantic versioning to prevent this in the future.
I am checking out multiple repositories like this:
- name: Checkout this repo
uses: actions/checkout@v2
with:
path: this
fetch-depth: 2
- name: Checkout another repo
uses: actions/checkout@v2
with:
repository: SomeAccount/AnotherRepo
path: another
fetch-depth: 2
But this action only works for default checkout path.
Like this:
- name: Get changed files from this repo
id: changed-files-this
uses: tj-actions/[email protected]
with:
# Same path as in the "checkout" action
path: this
- name: Get changed files from another repo
id: changed-files-another
uses: tj-actions/[email protected]
with:
# Same path as in the "checkout" action
path: another
No response
No response
This line in entrypoint.sh is adding temporary remote
git remote add temp_changed_files "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
This is not correct for enterprise github servicer has name like github.enterprise.com and therefore this code does not work and it is trying to access some gihub.com repository which does not exist
none
ubuntu-latest or ubuntu-20.04
set correct url as remote
No response
we are using selfhosted runners
Hi everyone,
First of all thank you for this action , It is really helpful!
As I understood right documentation all_modified_files
- showing only ACMR
Select all modified filesi.e. a combination of all added,copied, modified and renamed files (ACMR).
But , when I deleted directory with files it show as all_modified_files
. In my opinion It's wrong behaviour.
(Plz correct me if I wrong)
test_pipeline
and nested directory new
and few .yaml
files inside new
directory .all_modified_files
-show me everything correct.new
ubuntu-latest or ubuntu-20.04
Don’t output deleted files
Retrieving changes between 1bfe9ff893a8625996ba04b052cdf89e1e683520 (test-gha-custom-label) → 40ea730b3389a39578a9eeba23c1eda181dfb894 (test-gha-custom-label)
Checking for file changes: ".(yaml)$"...
Checking for file changes: "test-pipeline"...
Added files:
Copied files:
Deleted files: test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
Modified files: .github/workflows/test-label.yaml
Renamed files:
Type Changed files:
Unmerged files:
Unknown files:
All changed files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
All modified files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
Input files: .(yaml)$ test-pipeline
Matching modified files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
# my config
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
.(yaml)$
test-pipeline
I get the following error sometimes:
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
I haven't had time to try to reproduce it locally. I'm first posting here to check if this is a known issue or if someone else already had it before I spend more time troubleshooting it (I'm a bash
novice).
ubuntu-latest or ubuntu-20.04
There should be no errors.
Run tj-actions/changed-files@2f8c46f9d79d979656108f4fc4414c378ee4abed
with:
files: ^transform/snowflake-dbt/.*
base_sha: 01f529cacb2dff32b9a54cf946dce1c74c039a5a
sha: c6e8af0e7208d28653aab87352c9d5f81cc7742b
token: ***
separator:
env:
SNOWSQL_ACCOUNT: ***
SNOWSQL_USER: ***
SNOWSQL_PWD: ***
SNOWSQL_WAREHOUSE: dbt_ci_wh
changed-files
Getting HEAD info...
From https://github.com/voiapp/data-pipelines
* [new branch] master -> master
* [new branch] master -> origin/master
Retrieving changes between 01f529cacb2dff32b9a54cf946dce1c74c039a5a (master) → c6e8af0e7208d28653aab87352c9d5f81cc7742b (backfill_MRS_vehicle_not_available)
Checking for file changes: "^transform/snowflake-dbt/.*"...
Added files:
Copied files:
Deleted files:
Modified files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
Renamed files:
Type Changed files:
Unmerged files:
Unknown files:
All changed files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
All modified files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
Error: Process completed with exit code 1.
Great project, thanks for maintaining it! Very useful.
For security reasons, I have to hardcode the commit SHAs of external GitHub Actions. The one I'm using for this report is 2f8c46f, which is the equivalent of v9.3.
There's a possibility of returning the same file twice when it matches one or more regex used in the files input.
.github/workflows/test.yml
uses: tj-actions/changed-files@v9
with:
files: |
path-to-files
.(js|ts|tsx|scss)$
...
all
The list of changed files returned shouldn't be duplicated.
All changed files: path-to-files/test.js path-to-files/test.js
No response
The current changed file detection via only_deleted
and any_deleted
doesn't include deleted files which makes it tough to detect files that were deleted.
Adding two new boolean outputs should help with detecting file deletion.
- name: Run step when any listed file has been deleted
if: steps.changed-files.outputs.any_deleted == "true"
run: |
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
echo "$file was deleted"
done
- name: Run step when all listed files have been deleted
if: steps.changed-files.outputs.only_deleted == "true"
run: |
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
echo "$file was deleted"
done
No response
No response
Is your feature request related to a problem? Please describe.
Add support for checking a subset of files that have changed relative to the default branch.
- name: Get all changed files
id: changed_files
uses: ...
with:
files: ...
- name: Run step
if: steps.changed_files.outputs == 'true'
Describe the bug
When testing for changes in specific file types the any_changed output is true while it should be false.
To Reproduce
Steps to reproduce the behavior:
- name: Get specific changed files
id: specific_changed_files
uses: tj-actions/changed-files@v6
with:
files: |
.(php|css|js|vue)$
- name: Run step if any of the listed files above change
if: steps.specific_changed_files.outputs.any_changed == 'true'
run: |
echo "One or more files listed above has changed."
Expected behavior
echo "One or more files listed above has changed."
should not run since no files are changed as can be seen in the screenshot.
when using a custom container image on ubuntu-latest, changed-files
is unable to initialize a the git repository
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Error: Process completed with exit code 128.
consider this action --
quality-checks:
runs-on: ubuntu-latest
container:
image: 123456789.dkr.ecr.us-west-2.amazonaws.com/my-test-container:latest
credentials:
username: AWS
password: saved-password
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Get changed files
id: changed-files-specific
uses: tj-actions/[email protected]
with:
files: |
/__w/my-test-container/my-test-container/*.py
during the Initialize containers
step i see it create my container with a working directory--
/usr/bin/docker create --name 123456789amazonawscommytestcontainerklatest_91g223 --label c9e036 --workdir /__w/my-test-container/my-test-container
then during the actions/checkout
it wipes the correct working dir and checks out the code --
Syncing repository: MyRepo/my-test-container
Getting Git version info
Deleting the contents of '/__w/my-test-container/my-test-container'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive
then changed-files
seems to fail when getting the HEAD info --
Run tj-actions/[email protected]
changed-files
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Error: Process completed with exit code 128.
ubuntu-latest or ubuntu-20.04
is there a way to configure where changed-files
looks for the git repo? in this case it should initialize in /__w/my-test-container/my-test-container/
does it need this working-directory
option? https://github.community/t/use-working-directory-for-entire-job/16747/2
(seems like this would need some tweaks to the checkout
action to allow it to check out to a different directory.
No response
possible dupe of #100
hi,
I met the following errors when using git enterprise. btw, I use ssh login the git repo other than username/password. I changed other repo with .git subdirectory, it still complains the same error. I double checked my repo it works fine but still failed to get this github action works
Run tj-actions/changed-files@v7
with:
token: ***
separator:
/usr/bin/docker run --name fe336efc00c723f4a47d480e9c9a46f254d67_122cbd --label 6fe336 --workdir /github/workspace --rm -e INPUT_TOKEN -e INPUT_SEPARATOR -e INPUT_FILES -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/daniel/actions-runner/_work/_temp/_github_home":"/github/home" -v "/home/daniel/actions-runner/_work/_temp/_github_workflow":"/github/workflow" -v "/home/daniel/actions-runner/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/daniel/actions-runner/_work/temp-repo-4-github-action/temp-repo-4-github-action":"/github/workspace" 6fe336:efc00c723f4a47d480e9c9a46f254d67
fatal: not a git repository (or any parent up to mount point /github)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
changedfiles:
runs-on: [ self-hosted ]
name: Test changed-files
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v7
- name: List all modified files
run: |
for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
echo "$file was modified"
done
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
).github/workflows/codacy-analysis.yml
actions/checkout v4
codacy/codacy-analysis-cli-action v4.4.5
github/codeql-action v3
.github/workflows/codeql.yml
actions/checkout v4
github/codeql-action v3
github/codeql-action v3
github/codeql-action v3
.github/workflows/greetings.yml
actions/first-interaction v1
.github/workflows/issue-comment-job-example.yml
actions/checkout v4
actions/checkout v4
.github/workflows/manual-triggered-job-example.yml
actions/checkout v4
.github/workflows/matrix-example.yml
actions/checkout v4
actions/checkout v4
.github/workflows/multi-job-example.yml
actions/checkout v4
actions/checkout v4
.github/workflows/sync-release-version.yml
actions/checkout v4
tj-actions/release-tagger v4
tj-actions/sync-release-version v13
tj-actions/sync-release-version v13
tj-actions/git-cliff v1
peter-evans/create-pull-request v7.0.1
.github/workflows/test.yml
actions/checkout v4
actions/setup-node v4.0.3
tj-actions/eslint-changed-files v25
tj-actions/verify-changed-files v20
actions/upload-artifact v4
codacy/codacy-coverage-reporter-action v1
actions/checkout v4
actions/download-artifact v4
actions/download-artifact v4
actions/checkout v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/checkout v4
actions/checkout v4
actions/download-artifact v4
actions/checkout v4
actions/download-artifact v4
tj-actions/branch-names v8
nrwl/nx-set-shas v4
.github/workflows/update-readme.yml
actions/checkout v4
tj-actions/auto-doc v3
tj-actions/remark v3
tj-actions/verify-changed-files v20
peter-evans/create-pull-request v7
.github/workflows/workflow-run-example.yml
actions/checkout v4
actions/checkout v4
package.json
@actions/core ^1.10.0
@actions/exec ^1.1.1
@actions/github ^6.0.0
@octokit/rest ^21.0.0
@stdlib/utils-convert-path ^0.2.1
lodash ^4.17.21
micromatch ^4.0.5
yaml ^2.3.1
@types/jest ^29.5.2
@types/lodash ^4.14.195
@types/micromatch ^4.0.2
@types/node ^22.0.0
@types/uuid ^10.0.0
@typescript-eslint/eslint-plugin ^7.0.0
@typescript-eslint/parser ^7.0.0
@vercel/ncc ^0.38.0
eslint ^8.43.0
eslint-config-prettier ^9.0.0
eslint-plugin-github ^5.0.0
eslint-plugin-jest ^28.0.0
eslint-plugin-prettier ^5.0.0-alpha.2
jest ^29.5.0
prettier ^3.0.0
ts-jest ^29.1.0
typescript ^5.1.3
Based on the documentation using "${ARRAY}" and looping over the items results in a single item instead of looping over each item in an array.
ARRAY=(a b c d)
for i in "${ARRAY}"
echo i
This prints out:
a b c d
as opposed to:
a
b
c
d
all
a
b
c
d
No response
No response
Right now files
can be used to easily match files, essentially an "allow" list. For example, you can match any file which begins with a path, like ^path/to/directory
. However, it's not easy to exclude files. For example, if I wanted to match on all files in the path/to/directory
except files which end with .md
.
It may be easiest to accept another input, such as exclude-files
, which will simply be negated versions of the provided GREP regular expressions. For example, to exclude all files ending with .md
you could do exclude-files: \.md$
See also: #264 -- which if implemented could invalidate this ticket.
No response
Not working on self hosted github runners.
ubuntu-latest or ubuntu-20.04
Action should work on self hosted github runners.
error: remote temp_changed_files already exists.
### Anything else?
This is most likely because the script adds a new origin to calculate the changed files.
In the self hosted runner, the state is maintained and the subsequent builds run into the issue of where the required git origin is already added.
I think a check can be added to see if this already exists.
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
I am using the action as follows, but when I delete files in "mydir", they are not appearing in the summary.
e.g. I delete mydir/hello.txt
The deleted file is missing from the list "Checking for file changes" and "Deleted files:"
This happens every time.
steps:
- name: Get latest code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
mydir/**
ubuntu-latest or ubuntu-20.04
Deleted files should list the files that were deleted.
Run tj-actions/[email protected]
with:
files: mydir/**
token: ***
separator:
sha: XXXXX
env:
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_S3_BUCKET: ***
AWS_REGION: ***
changed-files
Getting HEAD info...
Retrieving changes between XXX (master) → XXXX (master)
Checking for file changes: "mydir/d"...
Checking for file changes: "mydir/gulpfile.js"...
Checking for file changes: "mydir/images"...
Checking for file changes: "mydir/slider"...
Checking for file changes: "mydir/style"...
Added files:
Copied files:
Deleted files:
Modified files:
Renamed files:
Type Changed files:
Unmerged files:
Unknown files:
All changed files:
All modified files:
Input files: mydir/**
Matching modified files:
Non Matching modified files: .github/workflows/main.yml
No response
When using a separator containing a forward slash, sed interprets it as a delimiter, leading to errors such as
Checking for file changes: ...
sed: -e expression #1, char 9: unknown option to `s'
https://github.com/tj-actions/changed-files/blob/main/entrypoint.sh#L118-L136
Either an option to choose the delimiter with a default to /
, e.g. setting SED_DELIMITER=@ would turn the sed commands into sed 's@ *@'"$INPUT_SEPARATOR"'@g'
and / would not be interpreted as a delimiter.
or
Escaping forward slashes used in separator.
The latter may reduce the number of initial errors or confusion more than the former.
Escaping forward slashes works fine for short separators, e.g. \/
but becomes onerous when using unixy paths, web addresses, etc.
No response
It seems that:
git remote set-url origin "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
is permanently breaking the next steps we have in the workflow that depends on it.
After executing the script origin should be set to it's original value instead of keeping it with INPUT_TOKEN
changed-file
stepall
I would expect to not have modified origin at the end of script execution
Our other scripts depend on git origin
string comparison for security reasons, having token forced is making them fail.
I work around that issue by adding extra step that is resetting changes:
- name: Fix get changed files origin
run: |
git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}"
Use case:
I want to run a workflow if and only if any file under a certain directory changes.
If any other files have changed I do not want to run the workflow.
In my case, I'm trying to auto-approve a PR using this action https://github.com/marketplace/actions/auto-approve
but only if files under the dev
directory have been updated, and nothing else.
Ideally something like this:
steps:
- uses: actions/checkout@v2
- name: Get changed files for dev
id: changed-files-dev
uses: tj-actions/[email protected]
with:
files: |
dev
- uses: hmarr/auto-approve-action@v2
if: steps.changed-files-dev.outputs.only_changed == 'true'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
Where only_changed
would be true if any file in that directory were present, and ONLY files in that directory were in the diff (i.e no other files)
I've tried something like this:
steps:
- uses: actions/checkout@v2
- name: Get changed files for dev
id: changed-files-dev
uses: tj-actions/[email protected]
with:
files: |
dev
- name: Get changed files for all
id: changed-files-rest
uses: tj-actions/[email protected]
with:
files: |
^(dev)
- uses: hmarr/auto-approve-action@v2
if: steps.changed-files-dev.outputs.any_changed == 'true' && steps.changed-files-rest.outputs.any_changed == 'false'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
But that doesn't seem to work and feels clunky.
No response
Describe the bug
I get the following:
Run tj-actions/[email protected]
Getting head sha...
fatal: ambiguous argument 'HEAD^1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Getting diff...
fatal: ambiguous argument 'HEAD^1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error: Process completed with exit code 128.
To Reproduce
My template:
- name: Get modified files using defaults
id: changed-files
uses: tj-actions/[email protected]
Expected behavior
That the system would get a list of changed files
Additional context
using ubuntu-latest
If you have spaces in your file names and you provide a custom separator (eg. separator: ",") all spaces are replaced by the separator and the results sorted.
embeds/general 412874536418279426/read-me-1 899830563651854336.json
Test 1/Test 1.json
- id: json_changes
uses: tj-actions/[email protected]
with:
files: |
.json$
separator: ","
- name: List modified files
run: |
echo ${{ steps.json_changes.outputs.all_modified_files }}
1.json,1/Test,412874536418279426/read-me-1,899830563651854336.json,Test,embeds/general
ubuntu-latest or ubuntu-20.04
I expect:
embeds/general 412874536418279426/read-me-1 899830563651854336.json,Test 2/Test 1.json
No response
No response
Im trying to find changes not since the last commit on main branch, but since the last commit on main branch with a successful action run.
I found this handy action: https://github.com/nrwl/last-successful-commit-action
but I find no way to define which commit to compare to.
I did find the sha
config variable, but apparently that is to say "what is the current" commit. Not what is the target commit to compare to.
Perhaps a target_sha
setting?
No response
No response
The action is not able to locate the last remote commit on the pull-request.
Here is the action YAML:
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
ref: "${{ github.event.pull_request.head.sha }}"
- id: changed-files
uses: tj-actions/changed-files@aae164d51be780a235cdeea89752bbacbbfee3c3
with:
files: |
^${{ env.PROJECT_PATH }}
sha: "${{ github.event.pull_request.head.sha }}"
since_last_remote_commit: "true"
When this workflow is executed, it results in several fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
errors, and all outputs are blank. That commit SHA is correct -- it was the last remote commit on the pull-request branch. It also returns the correct commit SHA if there are multiple commits pushed at the same time.
ubuntu-latest or ubuntu-20.04
I expect the action to provide a diff of files between the last remote commit on the pull-request (which it correctly figures out) and the HEAD commit of the pull-request (the last commit that was pushed -- which I have confirmed in the output is also correct). Perhaps the base ref needs to be explicitly fetched from the remote in order for it to be found.
Run tj-actions/changed-files@aae164d51be780a235cdeea89752bbacbbfee3c3
with:
files: ^libraries/terraform/name-provider
since_last_remote_commit: true
token: ***
separator:
sha: e42496235d245861a95249a5c04c06d3907f19a0
env:
PROJECT_NAME: terraform-name-provider
PROJECT_PATH: libraries/terraform/name-provider
Run bash $GITHUB_ACTION_PATH/sourcefiles.sh
bash $GITHUB_ACTION_PATH/sourcefiles.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
PROJECT_NAME: terraform-name-provider
PROJECT_PATH: libraries/terraform/name-provider
INPUT_FILES: ^libraries/terraform/name-provider
INPUT_FILES_FROM_SOURCE_FILE:
changed-files-from-source-file
Input Files: ^libraries/terraform/name-provider
All Unique Input files: ^libraries/terraform/name-provider
Run if [[ -n "" ]]; then
if [[ -n "" ]]; then
echo "::set-output name=base_sha::"
elif [[ "true" == "true" && -z "" ]]; then
echo "::set-output name=base_sha::9b20d537dc9a0943ad43cd8e6a08c444640a75e3"
fi
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
PROJECT_NAME: terraform-name-provider
PROJECT_PATH: libraries/terraform/name-provider
Run bash $GITHUB_ACTION_PATH/entrypoint.sh
bash $GITHUB_ACTION_PATH/entrypoint.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
PROJECT_NAME: terraform-name-provider
PROJECT_PATH: libraries/terraform/name-provider
GITHUB_SERVER_URL: https://github.com
GITHUB_REPOSITORY: [REDACTED]
GITHUB_BASE_REF: master
INPUT_SHA: e42496235d245861a95249a5c04c06d3907f19a0
INPUT_BASE_SHA: 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
INPUT_TOKEN: ***
INPUT_FILES: ^libraries/terraform/name-provider
INPUT_SEPARATOR:
INPUT_PATH:
changed-files
Resolving repository path...
Setting up 'temp_changed_files' remote...
No 'temp_changed_files' remote found
Creating 'temp_changed_files' remote...
Getting HEAD info...
From https://github.com/[REDACTED]
* [new branch] master -> master
* [new branch] master -> temp_changed_files/master
Retrieving changes between 9b20d537dc9a0943ad43cd8e6a08c444640a75e3 (master) → e42496235d245861a95249a5c04c06d3907f19a0 ([REDACTED])
Input files: ^libraries/terraform/name-provider
Checking for file changes: "^libraries/terraform/name-provider"...
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
Matching modified files:
fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
Matching deleted files:
Added files:
Copied files:
Deleted files:
Modified files:
Renamed files:
Type Changed files:
Unmerged files:
Unknown files:
All changed files:
All modified files:
As an aside, this logging can be misleading:
Retrieving changes between X (master) → Y (branch)
Since the X
commit may not be from master.
Is your feature request related to a problem? Please describe.
uh yes, when i use this workflow in windows-latest env, it cause a error:
Run tj-actions/changed-files@v7
with:
token: ***
separator:
Error: Container action is only supported on Linux
And that is because i should run my C++ workflow in win to use msvc, and i want to use change-file together
Describe the solution you'd like
Add win support
If I am not mistaken since_last_remote_commit
option compares all changes between the last commit available in remote.
When using the next step:
- name: Check changes
id: changed-files
uses: tj-actions/[email protected]
with:
# fetch-depth: 0
since_last_remote_commit: 'true'
I get the following result: README.md iv.yaml package.json
I am changing only the github action file between pushes, how is it possible?. What am I missing?.
Explanation of current behabior
No response
No response
There’s no clear distinction between the term changed and modified
To make a clear distinction between changed files and modified files the current all_changed_files needs to be renamed to all changed and modified files
No response
No response
When dependabot creates a PR to bump a package, calls to this action results in one of two errors
Resolving repository path...
Setting up 'temp_changed_files' remote...
No 'temp_changed_files' remote found
Creating 'temp_changed_files' remote...
error: remote temp_changed_files already exists.
Error: Process completed with exit code 3.
or
Resolving repository path...
Setting up 'temp_changed_files' remote...
No 'temp_changed_files' remote found
Creating 'temp_changed_files' remote...
Getting HEAD info...
fatal: could not read Password for 'https://***@github.com': No such device or address
Error: Process completed with exit code 128.
Simply create a workflow that triggers on Pull Requests and uses tj-actions/[email protected]
If dependabot creates the PR, then the action fails.
ubuntu-latest or ubuntu-20.04
Should work just the same as if a normal user created a PR
See above
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.