Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

release: v4.1.0 #143

Merged
merged 17 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

これは `git diff` を取得するための GitHub Actions です。
これは `git diff` を取得するための GitHub Actions です。
env または actionsの出力 から差分を得ることができます。

## Table of Contents

Expand All @@ -28,6 +29,7 @@
- [補足](#%E8%A3%9C%E8%B6%B3)
- [FROM, TO](#from-to)
- [下書きのプルリクエストで最新コミット差分のみをチェックする場合](#%E4%B8%8B%E6%9B%B8%E3%81%8D%E3%81%AE%E3%83%97%E3%83%AB%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%81%A7%E6%9C%80%E6%96%B0%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88%E5%B7%AE%E5%88%86%E3%81%AE%E3%81%BF%E3%82%92%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88)
- [Json形式で結果を取得する場合](#json%E5%BD%A2%E5%BC%8F%E3%81%A7%E7%B5%90%E6%9E%9C%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88)
- [Author](#author)

</details>
Expand Down Expand Up @@ -245,6 +247,33 @@ jobs:
# ...
```

### Json形式で結果を取得する場合
```yaml
on: pull_request
name: CI
jobs:
dump:
name: Dump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
+(src|__tests__)/**/*.ts
!src/exclude.ts
FORMAT: json
- run: echo '${{ env.GIT_DIFF }}' | jq .
```

Result:
```shell
Run echo '["yarn.lock"]' | jq .
[
"yarn.lock"
]
```

## Author
[GitHub (Technote)](https://github.com/technote-space)

Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

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

## Table of Contents

Expand All @@ -28,6 +29,7 @@ GitHub actions to get git diff.
- [Addition](#addition)
- [FROM, TO](#from-to)
- [Check only the latest commit differences in a draft Pull Request](#check-only-the-latest-commit-differences-in-a-draft-pull-request)
- [To get the result in Json format](#to-get-the-result-in-json-format)
- [Author](#author)

</details>
Expand Down Expand Up @@ -245,6 +247,33 @@ jobs:
# ...
```

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

Result:
```shell
Run echo '["yarn.lock"]' | jq .
[
"yarn.lock"
]
```

## Author
[GitHub (Technote)](https://github.com/technote-space)

Expand Down
12 changes: 6 additions & 6 deletions __tests__/process.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ describe('execute', () => {
'git remote add get-diff-action \'https://octocat:test token@github.com/hello/world.git\' || :',
'git fetch --no-tags --no-recurse-submodules \'--depth=10000\' get-diff-action \'refs/pull/55/merge:refs/remotes/get-diff-action/pull/55/merge\' \'refs/heads/master:refs/remotes/get-diff-action/master\' || :',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' \'--diff-filter=AMRC\' --name-only || :',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'package.json\'',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'abc/package.json\'',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'src/main.ts\'',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'package.json\'',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'abc/package.json\'',
'git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'src/main.ts\'',
]);
stdoutCalledWith(mockStdout, [
'[command]git remote add get-diff-action',
Expand All @@ -227,11 +227,11 @@ describe('execute', () => {
' >> abc/package.json',
' >> README.md',
' >> src/main.ts',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'package.json\'',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'package.json\'',
' >> 1 file changed, 25 insertions(+), 4 deletions(-)',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'abc/package.json\'',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'abc/package.json\'',
' >> 1 file changed, 25 insertions(+), 4 deletions(-)',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w \'src/main.ts\'',
'[command]git diff \'get-diff-action/master...get-diff-action/pull/55/merge\' --shortstat -w -- \'src/main.ts\'',
' >> 1 file changed, 25 insertions(+), 4 deletions(-)',
'::group::Dump diffs',
getLogStdout([
Expand Down
Loading