GithubHelp home page GithubHelp logo

get-diff-action's Introduction

Get Diff Action

CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

GitHub actions to get git diff.
You can get the differences via env or action output.

Table of Contents

Details

generated with TOC Generator

Screenshots

  1. Example workflow

    Example workflow

  2. Skip

    Skip

Usage

Basic Usage

on: pull_request
name: CI
jobs:
  eslint:
    name: ESLint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v6
        with:
          PATTERNS: |
            +(src|__tests__)/**/*.ts
            !src/exclude.ts
          FILES: |
            yarn.lock
            .eslintrc
      - name: Install Package dependencies
        run: yarn install
        if: env.GIT_DIFF
      - name: Check code style
        # Check only if there are differences in the source code
        run: yarn lint
        if: env.GIT_DIFF

Details of the patterns that can be specified

Example of matching files

  • src/main.ts
  • src/utils/abc.ts
  • __tests__/test.ts
  • yarn.lock
  • .eslintrc
  • anywhere/yarn.lock

Examples of non-matching files

  • main.ts
  • src/xyz.txt
  • src/exclude.ts

Examples of env

name value
GIT_DIFF 'src/main.ts' 'src/utils/abc.ts' '__tests__/test.ts' 'yarn.lock' '.eslintrc' 'anywhere/yarn.lock'
GIT_DIFF_FILTERED 'src/main.ts' 'src/utils/abc.ts' '__tests__/test.ts'
MATCHED_FILES 'yarn.lock' '.eslintrc' 'anywhere/yarn.lock'

Specify a little more detail

on: pull_request
name: CI
jobs:
  eslint:
    name: ESLint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v6
        with:
          PATTERNS: |
            +(src|__tests__)/**/*.ts
          FILES: |
            yarn.lock
            .eslintrc
      - name: Install Package dependencies
        run: yarn install
        if: env.GIT_DIFF
      - name: Check code style
        # Check only source files with differences
        run: yarn eslint ${{ env.GIT_DIFF_FILTERED }}  # e.g. yarn eslint 'src/main.ts' '__tests__/test.ts'
        if: env.GIT_DIFF && !env.MATCHED_FILES
      - name: Check code style
        # Check only if there are differences in the source code (Run a lint on all files if there are changes to yarn.lock or .eslintrc)
        run: yarn lint
        if: env.GIT_DIFF && env.MATCHED_FILES

If there is no difference in the source code below, this workflow will skip the code style check

  • src/**/*.ts
  • __tests__/**/*.ts

Behavior

  1. Get git diff

    git diff ${FROM}${DOT}${TO} '--diff-filter=${DIFF_FILTER}' --name-only

    e.g. (default)

    DOT: '...'
    DIFF_FILTER: 'AMRC'

    =>

    git diff ${FROM}...${TO} '--diff-filter=AMRC' --name-only

    =>

    .github/workflows/ci.yml
    __tests__/utils/command.test.ts
    package.json
    src/main.ts
    src/utils/command.ts
    src/docs.md
    yarn.lock
    

    ${FROM}, ${TO}

  2. Filtered by PATTERNS option

    e.g.

    PATTERNS: |
      src/**/*.+(ts|md)
      !src/utils/*

    =>

    src/main.ts
    src/docs.md
    
  3. Filtered by FILES option

    e.g.

    FILES: package.json

    =>

    package.json
    anywhere/package.json
    
  4. Mapped to absolute if ABSOLUTE option is true (default: false)

    e.g.

    /home/runner/work/my-repo-name/my-repo-name/src/main.ts
    /home/runner/work/my-repo-name/my-repo-name/src/docs.md
    
  5. Combined by SEPARATOR option

    e.g. (default)

    SEPARATOR: ' '

    =>

    /home/runner/work/my-repo-name/my-repo-name/src/main.ts /home/runner/work/my-repo-name/my-repo-name/src/docs.md
    

Outputs

name description e.g.
diff The results of diff file names.
If inputs SET_ENV_NAME(default: GIT_DIFF) is set, an environment variable is set with that name.
src/main.ts src/docs.md
count The number of diff files.
If inputs SET_ENV_NAME_COUNT(default: '') is set, an environment variable is set with that name.
100
insertions The number of insertions lines. (Available only if GET_FILE_DIFF is true)
If inputs SET_ENV_NAME_INSERTIONS(default: '') is set, an environment variable is set with that name.
100
deletions The number of deletions lines. (Available only if GET_FILE_DIFF is true)
If inputs SET_ENV_NAME_DELETIONS(default: '') is set, an environment variable is set with that name.
100
lines The number of diff lines. (Available only if GET_FILE_DIFF is true)
If inputs SET_ENV_NAME_LINES(default: '') is set, an environment variable is set with that name.
200

Action event details

Target events

eventName action
pull_request opened, reopened, synchronize, closed, ready_for_review
push *

If called on any other event, the result will be empty.

Addition

FROM, TO

condition FROM TO
tag push --- ---
pull request pull.base.ref (e.g. main) context.ref (e.g. refs/pull/123/merge)
push (which has related pull request) pull.base.ref (e.g. main) refs/pull/${pull.number}/merge (e.g. refs/pull/123/merge)
context.payload.before = '000...000' default branch (e.g. main) context.payload.after
else context.payload.before context.payload.after

Check only the latest commit differences in a draft Pull Request

on:
  pull_request:
    types: [opened, reopened, synchronize, closed, ready_for_review]

jobs:
  eslint:
    name: ESLint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v6
        with:
          CHECK_ONLY_COMMIT_WHEN_DRAFT: true
      # ...

To get the result in Json format

on: pull_request
name: CI
jobs:
  dump:
    name: Dump
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v6
        with:
          PATTERNS: |
            +(src|__tests__)/**/*.ts
            !src/exclude.ts
          FORMAT: json
      - run: echo '${{ env.GIT_DIFF }}' | jq .

Result:

> Run echo '["yarn.lock"]' | jq .
[
  "yarn.lock"
]

Specify a relative path

GitHub Actions doesn't support working-directory for uses, so you can't run this action separately for monorepo configuration, etc. However, if you specify the RELATIVE option, it will be used as --relative=<RELATIVE> for git diff.

https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---relativeltpathgt

on: pull_request
name: CI
jobs:
  dump:
    name: Dump
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v6
        with:
          PATTERNS: '*.ts'
          RELATIVE: 'src/abc'
      - run: echo ${{ env.GIT_DIFF }}

If the files src/abc/test1.ts, src/abc/test2.ts, src/abc/test3.txt, and src/test4.ts exist, the result will be as follows:

> Run echo 'test1.ts' 'test2.ts'
test1.ts test2.ts

Author

GitHub (Technote)

Blog

get-diff-action's People

Contributors

peterbe avatar technote-space avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

get-diff-action's Issues

"Warning: Please checkout before call this action" even using the mentioned action

Describe the bug: バグの概要

Message "Warning: Please checkout before call this action." always appears and the diff remains empty, even with checkout executing right before get-diff-action@v5

To Reproduce: 再現手順

Steps to reproduce the behavior:

      ...
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Git diff
        id: git-diff
        uses: technote-space/get-diff-action@v5
        with:
          FILES: |
            envs/${{ matrix.environment.name }}.json
      - name: Upload environment variables
        if: ${{ steps.git-diff.outputs.diff }}
        run: ... (never runs.. output always empty)

Expected behavior: 期待する動作

Get the diff correctly without "Warning: Please checkout before call this action." message

Screenshots: スクリーンショット

image

fix: FROM, TO

condition: pull request (not default branch)

condition: pull request
condition: push to pull request

GIT_DIFF includes all files

Describe the bug: バグの概要

To Reproduce: 再現手順

Steps to reproduce the behavior:

  1. Go to mdn/yari#1419
  2. Click on https://github.com/mdn/yari/pull/1419/checks?check_run_id=1240693958
  3. Scroll down to the error
  4. See error

Expected behavior: 期待する動作

Not even run anything because the PR didn't contain any changes to (PREFIX) docs and (SUFFIX) .md or the README.md.

Additional context: 補足

Perhaps I'm misinterpreting the documentation but I was expecting env.GIT_DIFF to be the result of the filtering I do with PREFIX, SUFFIX, and FILES. Not the bare naked git diff of the PR.

Is this regression from v3 or am I just not understanding the documentation for v4??

GHSE Support

Describe the bug: バグの概要

The action somewhere (I can not locate it) to refer to github.com directly. This is an issue for all GHSE users.

To Reproduce: 再現手順

Steps to reproduce the behavior:
Run the action on GHSE and check the logs: We run it at SAP and the result is:

git remote add get-diff-action
  >> fatal: remote get-diff-action already exists.
git fetch --no-tags --no-recurse-submodules '--depth=10000' get-diff-action 'refs/pull/25862/merge:refs/remotes/get-diff-action/pull/25862/merge' 'refs/heads/master:refs/remotes/get-diff-action/master'
  >> remote: Invalid username or password.
  >> fatal: Authentication failed for 'https://github.com/fieldservice/portal.git/'
git diff 'get-diff-action/master...get-diff-action/pull/25862/merge' '--diff-filter=AMRC' --name-only
##[warning]  >> fatal: ambiguous argument 'get-diff-action/master...get-diff-action/pull/25862/merge': unknown revision or path not in the working tree.
##[warning]  >> Use '--' to separate paths from revisions, like this:
##[warning]  >> 'git <command> [<revision>...] -- [<file>...]'
Dump diffs
  []
Dump output
  diff: 
  filtered_diff: 
  matched_files: 
  count: 0
  insertions: 0
  deletions: 0
  lines: 0

Expected behavior: 期待する動作

>> fatal: Authentication failed for 'https://github.com/fieldservice/portal.git/'

It should refer to the internal repository: https://github.sap.com/fieldservice/portal.git/

Screenshots: スクリーンショット

image

Operating environment: バグが発生した環境

GHSE 2.11

Additional context: 補足

Did I miss an input variable?

"unknown revision or path not in the working tree" should fail

Describe the bug: バグの概要

I'm not sure what the bug is. Basically, it should have crashed if it couldn't figure out what the difference was.
See this PR: https://github.com/mdn/content/pull/6734/files

The CI depends on get-diff-action to get a list of the files that would be tested in CI.
Once that's figured out, it runs a Node build for those specific files and if anything is wrong, it should break the build.
The problem is that get-diff-action didn't spot any changed files, so that part of CI never ran.

Here's the CI run: https://github.com/mdn/content/actions/runs/1015759281

Screenshot with the get-diff-action portion expanded.
Screen Shot 2021-07-14 at 9 43 16 AM

I still don't know why it didn't work on that PR but worked and continues to work on all other PRs. Perhaps the owner of the PR did something strange like a rebase forced push while the CI was running.

Either way, bug is if it can't even successfully run the git diff ... command, it should crash and fail. Instead, we got a GIT_DIFF that's empty.
Our CI depends on...:

      - uses: technote-space/[email protected]
        id: git_diff_content
        with:
          PATTERNS: files/**/*.+(html|md)
          SET_ENV_NAME: GIT_DIFF_CONTENT

      - name: Build changed content
        if: ${{ env.GIT_DIFF_CONTENT }}

Perhaps somewhere, get-diff-action, which is written in TypeScript, uses github-action-helper to call out to native git as a sub-command and perhaps it failed to bubble up that a command didn't exit 0.

To Reproduce: 再現手順

No idea. Sorry.

Expected behavior: 期待する動作

If it can't git diff ... because there's something wrong with the branch or the remote or something, it should fail.

Moved files doesn't appear in git-diff actions

Hi, sorry to bother you again with this bug, this time a minimal example is created so the issue is more visible.

Describe the bug: バグの概要

If a file is moved from one directory to another within the project, only destination directory appears in git-diff. (All the GIT_FILTERS are set up).
Check the link below.

To Reproduce: 再現手順

Please visit: Minimal example

Expected behavior: 期待する動作

All directories that have been changed appear in git-diff

Operating environment: バグが発生した環境

  • Version of software
  • OS: ubuntu 20.04

pull request の場合の from, to 変更

現在:FROM = base ref, TO = merge ref
変更:FROM = payload.before, TO = payload.after

プルリクエスト自体の差分を取得する場合はオプション指定
MERGE_DIFF = true

Super slow on large private repo

Please describe your suggestion: 提案の概要

I'm adding this:

      - name: Gather diff files
        uses: technote-space/get-diff-action@947c47d16bc66137e567e55d74cdf752fed2695c
        id: get_diff_files
        with:
          SET_ENV_NAME: DIFF_FILES

It works. But it's really really slow. It takes about 3 minutes to complete.
Yes, the repo has a lot of files. Just doing the actions/checkout takes 10-11 seconds. So I don't understand why it should take 3 minutes to execute the git diff. Is it because the action depends on doing a non-shallow checkout or something?

Describe the solution you'd like: 考えうる解決方法

That it doesn't take so long.

Describe alternatives you've considered: 考えうる代替案

None.

Additional context: 補足

I might be able to set up a reproducible case on a "mirror" of this repo.

Git-diff failed in remote repo

Describe the bug: バグの概要

I tried runnig the action as describes in README.md file but I got the following erro:
at Command.execAsync (D:\a_actions\technote-space\get-diff-action\v5.0.2\dist\index.js:4935:27)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: command [git fetch] exited with code 1. message: fatal: ''--depth=10000'' does not appear to be a git repository
fatal: Could not read from remote repository.

I got this error on v5, v5.0.2

To Reproduce: 再現手順

Steps to reproduce the behavior:

  1. activate the action itself from different account

Expected behavior: 期待する動作

Screenshots: スクリーンショット

Screen Shot 2021-11-28 at 14 55 05

Operating environment: バグが発生した環境

  • 5, 5.0.2
  • OS: windows-latest
  • Browser: Chrome
  • etc.

Is it possible to get diff between a HEAD and the main/master branch when the context is `push`?

Hello.

Sorry if this has been asked before. But is it possible to get a diff between the main/master branch and the HEAD of the branch to which a commit has been pushed? I am aware that this is already the case for PRs but is it possible to do this in cases of push as well?

I have tried these:

  with:
    FROM: master
  env:
    FROM: master

Both don't work though I was just guessing.

Any help is appreciated. Thanks in advance.

Support repository_dispatch command event

Please describe your suggestion:

we use the https://github.com/peter-evans/slash-command-dispatch action to create chatops workflows, which means we use the action to trigger certain github actions, in case a developer uses on of the defined keywords in a newly created comment.

e.g. /csfix to trigger a github action run which fixes CS issues and commits them into a PR.

with this action we get events with a name of github.event_name == 'repository_dispatch'.

when triggering such events the get-diff-action does not detect a DIFF and therefore stops working for our use case. I guess we hit the case

If called on any other event, the result will be empty.

described in https://github.com/technote-space/get-diff-action#action-event-details

Describe the solution you'd like:

it would be great if this action could support the repository_dispatch event

Describe alternatives you've considered

atm we use a combination of if: and a predefined ENV var, to work around the mentiond problem:

    - name: Init Git-Diff for repository_dispatch event case
      run: echo "::set-env name=GIT_DIFF::1"

    - name: Detect whether php files changed
      if: "github.event_name != 'repository_dispatch'"
      uses: technote-space/get-diff-action@v2
      with:
        SUFFIX_FILTER: .php

Indicate when git diff failed because a branch was force-pushed

Please describe your suggestion: 提案の概要

Detect when git diff failed, e.g., due to force-push to the branch (after rebasing on top of upstream).

Describe the solution you'd like: 考えうる解決方法

git already detects invalid diffs and reports an error like this:

##[warning]  >> fatal: Invalid symmetric difference expression {{non-existent revision}}...{{revision being tested}}

This action can just check for git's return value and relay the error status and error message in an output.

Describe alternatives you've considered: 考えうる代替案

Not force-pushing

This is impossible since force-pushing is crucial for rebasing on top of upstream.

Considering an "empty diff" as failed diff

When diff fails, this action returns this:

Dump output
  diff: 
  filtered_diff: 
  matched_files: 
  count: 0
  insertions: 0
  deletions: 0
  lines: 0

Since in this case lines is always 0, it can be used in GitHub Action if: statement to work around this bug. This is just a work-around.

Using GitHub's built-in

GitHub Actions provide enough data to avoid using any actions, for the most part. github context includes github.event (useful for differentiating pull requests from pushes), and github.sha, github.ref, github.head_ref` (for knowing revisions to diff). This might be enough to avoid any using Actions.

Using another action

Other actions might be aware of force-pushing. I haven't tested other actions yet.

Additional context: 補足

GitHub Actions reports a warning, but it does not consider it an error (and displays the green checkmark next to the commit). The warning looks like this:
image

fetch depth

制限すると一度に多くの変更を push した場合などに diff が取れない
depth 3 にしているのを除去

Outdated readme

Describe the bug: バグの概要

Readme still has a screenshot with removed options PREFIX_FILTER/SUFFIX_FILTER at the very top! It's the first thing people see!

Please, just remove it as everything is being explained below / replace it with the new PATTERNS/FILES option.

Make node dependency optional

Describe the bug: バグの概要

I don't have node in my base container and I don't see why it would be required to run a git diff.

To Reproduce: 再現手順

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

[My Custom CI/build] 🐳 docker cp src=/Users/stefaan/.cache/act/technote-space-get-diff-action@v3 dst=/actions/
| OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: "node": executable file not found in $PATH": unknown

Expected behavior: 期待する動作

This action could detect that node is missing and skip the part that requires node.

Screenshots: スクリーンショット

Operating environment: バグが発生した環境

  • Version of software
  • OS: [e.g. Windows10]
  • Browser: [e.g. Chrome, Safari]
  • etc.

Additional context: 補足

jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    container:
      image: wdpk/wdpk

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v3
        with:
          PREFIX_FILTER: |
            wdpk/

差分の詳細を算出しないモードの追加

Please describe your suggestion: 提案の概要

一つずつ差分の行数を取得しているため大量に差分がある場合にかかる
おそらく #172 はそれが原因
正直、差分の行数を使うことのほうが少ないと思うので、デフォルトでは行数を計算する動作を行わないようにして、パラメータで指定があったら計算するようにする

Describe the solution you'd like: 考えうる解決方法

機能的には現状問題ない
性能の問題

Describe alternatives you've considered: 考えうる代替案

他のアクションを使用
自分で git diff する
など

Additional context: 補足

Support file(s) matching as well as prefixes and suffixes

Please describe your suggestion: 提案の概要

We have a repo that looks like this:

- /
  - package.json
  src/
    - foo.js
    - style.css
    - bar.js

Inside, the package.json it looks like this:

{
  "scripts": {
    "lint": "eslint 'src*.js'"
  },
  "dependencies": {
    "eslint": "6.8.0"
  }
}

If none of the src/*.js files have changed, it might not be any point in running eslint. So you use get-diff-action to bail on the running of yarn lint.

But what if a PR is created that...

  "dependencies": {
-   "eslint": "6.8.0"
+   "eslint": "7.0.0"
  }

That might break and you won't be running it because non of your files were changed.
Now, you have a mismatch in your master branch of the assumed eslint version and your source code.

This actually happened to us recently on https://github.com/mdn/kuma where we didn't notice that an upgrade of eslint broke all future PRs that do touch the source code files

Describe the solution you'd like: 考えうる解決方法

Not sure! You're the expert @technote-space
Perhaps something like:

      - uses: technote-space/get-diff-action@v3
        with:
          PREFIX_FILTER: |
            src
            __tests__
          SUFFIX_FILTER: .ts
          FILES_FILTER: |
            /package.json
            /.eslintrc

That would mean it matches src/**/*.ts OR __tests__/**/*.ts OR package.json OR /package.json OR /.eslintrc

It might be worth considering that you don't specify where the file is. Like you can do in a .gitignore meaning this would work too:

      - uses: technote-space/get-diff-action@v3
        with:
          FILES_FILTER: |
            package.json
            anywhere/.eslintrc

So it'd match for /package.json OR /some/folder/package.json OR /anywhere/.eslintrc or /some/folder/anywhere/.eslintrc.

Describe alternatives you've considered: 考えうる代替案

Adding package.json as a SUFFIX_FILTER but I'm not sure it would work. Haven't tested :)

Additional context: 補足

I'm not sure if it's best to call it FILES_FILTER or FILE_FILTER because after all it's currently PREFIX_FILTER not PREFIXES_FILTER.

My example above uses eslint and package.json but it's just an example.

Directory assigned in PATTERNS doesn't appear in git-diff if a file was moved out.

Describe the bug: バグの概要

First of all great job on the project, thanks!
The problem we faced while using get-diff-action: it doesn't return True for GIT_DIFF environment variable for directories which are added to PATTERNS and files are moved out from them, only destination directories considered to be changed and env.GIT_HUB for those are True.
Why it is important? Consider you run gha jobs in a matrix and you only want to test packages which have been changed. If you move some functionality, you expect that both initial package and destination one will run tests in GHA but in fact only destination one is enabled.

To Reproduce: 再現手順

Steps to reproduce the behavior:

  1. Create 2 directories within the project
  2. Create a file in one of them and add this directory to PATTERNS
  3. At this point env.GIT_HUB should be True
  4. Move the file to the second directory which is not added to PATTERNS
  5. env.GIT_HUB should also be True, since the directory in PATTERNS has changed, in fact it returns False.
  6. Optional. If you add destination directory to the PATTERNS: env.GIT_HUB is True.

Expected behavior: 期待する動作

In the scenario where we move files, both initial directory and destination one should appear in git-diff and env.GIT_HUB has to be True for both of them.

Operating environment: バグが発生した環境

  • Version of software
  • OS: [Ubuntu 20.04]

Additional context: 補足

We added to DIFF_FILTER all possible filters.

Get diff only of latest commit

As far as I understood it, does the current action take a diff of all files changed within the current PR - no matter in which commit it was..?

We would like to check whether only the latest commit within a PR changes certain files.
That way we could skip action more fine grained and save some github action minutes

Please add support for ignoring files from a specific path

Please describe your suggestion: 提案の概要

I want to get all git diff files except from a specific folder, that folder could be anywhere in the start, mid or end of the path. For example, I want all .py files but not from the migrations folder

/migrations/abc.py 
/feature/migrations/abc.py 
/migrations/files/abc.py

Describe the solution you'd like: 考えうる解決方法

Ignore filtered files which has migrations anywhere in path

IGNORE_PATH: |
  migrations

Describe alternatives you've considered: 考えうる代替案

Currently, there is no alternate for this, I am removing files from the final output using script 😞

command [git diff] exited with code 128. message: fatal: Invalid symmetric difference expression

Hi! Ran into this error.
Unfortunately can't share link to the build

      - uses: technote-space/get-diff-action@v6
        name: "check if build has changed"
        with:
          PATTERNS: dist
Error: command [git diff] exited with code 128. message: fatal: Invalid symmetric difference expression b8c8229067a65f5901277251d0f5850b430a7b20...c32b61106932f1ed414fc4ee934d6ee03cf09e43

    at Command.execAsync (/home/runner/work/_actions/technote-space/get-diff-action/v6/dist/index.js:4947:27)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: command [git diff] exited with code 128. message: fatal: Invalid symmetric difference expression b8c8229067a65f5901277251d0f5850b430a7b20...c32b61106932f1ed414fc4ee934d6ee03cf09e43

Case insensitive filtering

Please describe your suggestion: 提案の概要

I only want to run my action if there's a .png or .jpeg or .PnG or a .JpEg etc. in the git diff.
But I don't want to have to write:

      - uses: technote-space/get-diff-action@v1
        id: git_diff_content
        with:
          SEPARATOR: ","
          SUFFIX_FILTER: |
             .png
             .Png
             .PNg
             .PNG
             .pNG
             ....etc....

Describe the solution you'd like: 考えうる解決方法

Some way to express case insensitivity on the git diff files.

Describe alternatives you've considered: 考えうる代替案

Manually replicate much of what get-diff-action does :)

Additional context: 補足

Another thing that would be useful to me is to exclude.
Actually, in my project, most files will be .html so I'd be happy if I could express something like new RegExp("[^\.html]$", 'i') if that makes sense.

pull も対象にする

  • 対象イベントに pull を追加
  • FROMTO を削除
  • pull 時に 関連するPRを取得して base ref と number => merge ref を取得・生成

This is not target event

Describe the bug: バグの概要

I get This is not target event when trying to run the action

==================================================

This is not target event.
Dump diffs

Dump output

Operating environment: バグが発生した環境

  • Version of software
  • OS: ubuntu 20.04

Additional context: 補足

possible to get the full diff?

Please describe your suggestion:

Is it possible to get the full diff and not just the list of changed files? This looks really useful for a workflow where I want to use clang-format-diff but I'd want the git diff.

For example, maybe an option full: true with the default to false?

Thanks!

Fail to run on windows

Describe the bug: バグの概要

https://github.com/crypto-org-chain/cosmwasm-plus-plus/pull/8/checks?check_run_id=2416758615

To Reproduce: 再現手順

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior: 期待する動作

Screenshots: スクリーンショット

Operating environment: バグが発生した環境

  • Version of software
  • OS: [e.g. Windows10]
  • Browser: [e.g. Chrome, Safari]
  • etc.

Additional context: 補足

Add a 'working-directory' option

Please describe your suggestion: 提案の概要

I have a monorepo where subdirectories are NPM packages, each with their own package.json. I want to run ESLint from each subdirectory only on modified files in a PR, and want to use this action to provide the list of files that were changed.

However, the action runs in the root by default, where there is package.json. So the list always looks like: [subdirectory/**/file, etc.]. Whereas I would like to receive it as [**/file, etc.]

Describe the solution you'd like: 考えうる解決方法

A working-directory option, similarly to run e.g.:
Screenshot 2021-07-01 at 17 03 53

Then, git diff could run with the --relative flag.

Describe alternatives you've considered: 考えうる代替案

Using bash to process the file names returned by the action – doable but very cumbersome.

Additional context: 補足

n/a

support using the action multiple times

Please describe your suggestion:

I need to check whether either PHP files changed, or if a file named "composer.lock" changed.

I didn't see how I can combine such different patterns.

Describe the solution you'd like:

a possible solution would be if I could use the get-diff-action 2 times in my workflow.
only thing required by the action would be, that I could provide a parameter from the outside, which allows me to tell the Action which ENV var it should report its result into.

atm the env.GIT_DIFF works as long as I only have the action 1 time.
if I use it a 2nd time, it would be great I could tell the action which ENV var it should use

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.