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

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 9, 2020
1 parent a7342dc commit 30c0640
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 57 deletions.
59 changes: 31 additions & 28 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ jobs:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
with:
PREFIX_FILTER: |
src
__tests__
SUFFIX_FILTER: .ts
PATTERNS: |
+(src|__tests__)/**/*.ts
!src/exclude.ts
FILES: |
yarn.lock
.eslintrc
Expand All @@ -69,6 +68,9 @@ jobs:
run: yarn eslint ${{ env.GIT_DIFF }}
if: env.GIT_DIFF
```
[指定可能なパターンの詳細](https://github.com/isaacs/minimatch#minimatch)
### マッチするファイルの例
- src/main.ts
- src/utils/abc.ts
Expand All @@ -80,10 +82,11 @@ jobs:
### マッチしないファイルの例
- main.ts
- src/xyz.txt
- src/exclude.ts
### 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'` |
Expand All @@ -98,12 +101,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
PREFIX_FILTER: |
src
__tests__
SUFFIX_FILTER: .ts
PATTERNS: |
+(src|__tests__)/**/*.ts
FILES: |
yarn.lock
.eslintrc
Expand Down Expand Up @@ -147,22 +148,24 @@ jobs:
package.json
src/main.ts
src/utils/command.ts
src/docs.md
yarn.lock
```
[${FROM}, ${TO}](#from-to)
1. `PREFIX_FILTER` や `SUFFIX_FILTER` オプションによるフィルタ
1. `PATTERNS` オプションによるフィルタ
例:
```yaml
SUFFIX_FILTER: .ts
PREFIX_FILTER: src/
PATTERNS: |
src/**/*.+(ts|md)
!src/utils/*
```
=>
```
src/main.ts
src/utils/command.ts
src/docs.md
```

1. `FILES` オプションによるフィルタ
Expand All @@ -182,7 +185,7 @@ jobs:
例:
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts
/home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
/home/runner/work/my-repo-name/my-repo-name/src/docs.md
```

1. `SEPARATOR` オプションの値で結合
Expand All @@ -193,32 +196,32 @@ jobs:
```
=>
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts /home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
/home/runner/work/my-repo-name/my-repo-name/src/main.ts /home/runner/work/my-repo-name/my-repo-name/src/docs.md
```

## 出力
| name | description | e.g. |
|:---:|:---|:---:|
|diff|差分のあるファイルの結果<br>`SET_ENV_NAME`(default: `GIT_DIFF`) が設定されている場合、その名前で環境変数が設定されます|`src/main.ts src/utils/command.ts`|
|count|差分のあるファイル数<br>`SET_ENV_NAME_COUNT`(default: `''`) が設定されている場合、その名前で環境変数が設定されます|`100`|
|insertions|追加された行数<br>`SET_ENV_NAME_INSERTIONS`(default: `''`) が設定されている場合、その名前で環境変数が設定されます|`100`|
|deletions|削除された行数<br>`SET_ENV_NAME_DELETIONS`(default: `''`) が設定されている場合、その名前で環境変数が設定されます|`100`|
|lines|追加された行数と削除された行数の和<br>`SET_ENV_NAME_LINES`(default: `''`) が設定されている場合、その名前で環境変数が設定されます|`200`|
|:---|:---|:---|
| diff | 差分のあるファイルの結果<br>`SET_ENV_NAME`(default: `GIT_DIFF`) が設定されている場合、その名前で環境変数が設定されます | `src/main.ts src/docs.md` |
| count | 差分のあるファイル数<br>`SET_ENV_NAME_COUNT`(default: `''`) が設定されている場合、その名前で環境変数が設定されます | `100` |
| insertions | 追加された行数<br>`SET_ENV_NAME_INSERTIONS`(default: `''`) が設定されている場合、その名前で環境変数が設定されます | `100` |
| deletions | 削除された行数<br>`SET_ENV_NAME_DELETIONS`(default: `''`) が設定されている場合、その名前で環境変数が設定されます | `100` |
| lines | 追加された行数と削除された行数の和<br>`SET_ENV_NAME_LINES`(default: `''`) が設定されている場合、その名前で環境変数が設定されます | `200` |

## Action イベント詳細
### 対象イベント
| eventName | action |
|:---:|:---:|
|pull_request|opened, reopened, synchronize, closed, ready_for_review|
|push|*|
|:---|:---|
| pull_request | opened, reopened, synchronize, closed, ready_for_review |
| push | * |

もしこれ以外のイベントで呼ばれた場合、結果は空になります。

## 補足
### FROM, TO
| condition | FROM | TO |
|:---:|:---:|:---:|
| tag push |---|---|
|:---|:---|:---|
| tag push | --- | --- |
| pull request | pull.base.ref (e.g. master) | context.ref (e.g. refs/pull/123/merge) |
| push (has related pull request) | pull.base.ref (e.g. master) | `refs/pull/${pull.number}/merge` (e.g. refs/pull/123/merge) |
| context.payload.before = '000...000' | default branch (e.g. master) | context.payload.after |
Expand All @@ -236,7 +239,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
CHECK_ONLY_COMMIT_WHEN_DRAFT: true
# ...
Expand Down
59 changes: 31 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ jobs:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
with:
PREFIX_FILTER: |
src
__tests__
SUFFIX_FILTER: .ts
PATTERNS: |
+(src|__tests__)/**/*.ts
!src/exclude.ts
FILES: |
yarn.lock
.eslintrc
Expand All @@ -69,6 +68,9 @@ jobs:
run: yarn lint
if: env.GIT_DIFF
```
[Details of the patterns that can be specified](https://github.com/isaacs/minimatch#minimatch)
### Example of matching files
- src/main.ts
- src/utils/abc.ts
Expand All @@ -80,10 +82,11 @@ jobs:
### 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'` |
Expand All @@ -98,12 +101,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
PREFIX_FILTER: |
src
__tests__
SUFFIX_FILTER: .ts
PATTERNS: |
+(src|__tests__)/**/*.ts
FILES: |
yarn.lock
.eslintrc
Expand Down Expand Up @@ -147,22 +148,24 @@ If there is no difference in the source code below, this workflow will skip the
package.json
src/main.ts
src/utils/command.ts
src/docs.md
yarn.lock
```
[${FROM}, ${TO}](#from-to)
1. Filtered by `PREFIX_FILTER` or `SUFFIX_FILTER` option
1. Filtered by `PATTERNS` option
e.g.
```yaml
SUFFIX_FILTER: .ts
PREFIX_FILTER: src/
PATTERNS: |
src/**/*.+(ts|md)
!src/utils/*
```
=>
```
src/main.ts
src/utils/command.ts
src/docs.md
```

1. Filtered by `FILES` option
Expand All @@ -182,7 +185,7 @@ If there is no difference in the source code below, this workflow will skip the
e.g.
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts
/home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
/home/runner/work/my-repo-name/my-repo-name/src/docs.md
```

1. Combined by `SEPARATOR` option
Expand All @@ -193,32 +196,32 @@ If there is no difference in the source code below, this workflow will skip the
```
=>
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts /home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
/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.<br>If inputs `SET_ENV_NAME`(default: `GIT_DIFF`) is set, an environment variable is set with that name.|`src/main.ts src/utils/command.ts`|
|count|The number of diff files.<br>If inputs `SET_ENV_NAME_COUNT`(default: `''`) is set, an environment variable is set with that name.|`100`|
|insertions|The number of insertions lines.<br>If inputs `SET_ENV_NAME_INSERTIONS`(default: `''`) is set, an environment variable is set with that name.|`100`|
|deletions|The number of deletions lines.<br>If inputs `SET_ENV_NAME_DELETIONS`(default: `''`) is set, an environment variable is set with that name.|`100`|
|lines|The number of diff lines.<br>If inputs `SET_ENV_NAME_LINES`(default: `''`) is set, an environment variable is set with that name.|`200`|
|:---|:---|:---|
| diff | The results of diff file names.<br>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.<br>If inputs `SET_ENV_NAME_COUNT`(default: `''`) is set, an environment variable is set with that name. | `100` |
| insertions | The number of insertions lines.<br>If inputs `SET_ENV_NAME_INSERTIONS`(default: `''`) is set, an environment variable is set with that name. | `100` |
| deletions | The number of deletions lines.<br>If inputs `SET_ENV_NAME_DELETIONS`(default: `''`) is set, an environment variable is set with that name. | `100` |
| lines | The number of diff lines.<br>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|*|
|:---|:---|
| 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 |---|---|
|:---|:---|:---|
| tag push | --- | --- |
| pull request | pull.base.ref (e.g. master) | context.ref (e.g. refs/pull/123/merge) |
| push (has related pull request) | pull.base.ref (e.g. master) | `refs/pull/${pull.number}/merge` (e.g. refs/pull/123/merge) |
| context.payload.before = '000...000' | default branch (e.g. master) | context.payload.after |
Expand All @@ -236,7 +239,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
CHECK_ONLY_COMMIT_WHEN_DRAFT: true
# ...
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v3.3.1","branch":"gh-actions","tags":["test/v3.3.1","test/v3.3","test/v3"],"updated_at":"2020-10-09T14:35:54.054Z"}
{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v3.3.1","branch":"gh-actions","tags":["test/v3.3.1","test/v3.3","test/v3"],"updated_at":"2020-10-09T15:44:45.206Z"}

0 comments on commit 30c0640

Please sign in to comment.