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

Commit 45a426b

Browse files
Merge pull request #12 from technote-space/release/v1.0.4
Release/v1.0.4
2 parents eeadf7e + 1e4ab47 commit 45a426b

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
with:
1818
fetch-depth: 3
1919
- uses: technote-space/get-diff-action@gh-actions
20-
id: git-diff
2120
with:
2221
PREFIX_FILTER: |
2322
src/
@@ -27,21 +26,21 @@ jobs:
2726
- name: Get Yarn Cache Directory
2827
id: yarn-cache
2928
run: echo "::set-output name=dir::$(yarn cache dir)"
30-
if: steps.git-diff.outputs.diff
29+
if: env.GIT_DIFF
3130
- name: Cache node dependencies
3231
uses: actions/cache@v1
3332
with:
3433
path: ${{ steps.yarn-cache.outputs.dir }}
3534
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3635
restore-keys: |
3736
${{ runner.os }}-yarn-
38-
if: steps.git-diff.outputs.diff
37+
if: env.GIT_DIFF
3938
- name: Install Package dependencies
4039
run: yarn install
41-
if: steps.git-diff.outputs.diff
40+
if: env.GIT_DIFF
4241
- name: Check code style
43-
run: yarn eslint ${{ steps.git-diff.outputs.diff }}
44-
if: steps.git-diff.outputs.diff
42+
run: yarn eslint ${{ env.GIT_DIFF }}
43+
if: env.GIT_DIFF
4544
- uses: 8398a7/action-slack@v1
4645
with:
4746
type: failure
@@ -62,7 +61,6 @@ jobs:
6261
with:
6362
fetch-depth: 3
6463
- uses: technote-space/get-diff-action@gh-actions
65-
id: git-diff
6664
with:
6765
PREFIX_FILTER: |
6866
src/
@@ -75,31 +73,31 @@ jobs:
7573
uses: actions/setup-node@v1
7674
with:
7775
node-version: ${{ matrix.node }}
78-
if: steps.git-diff.outputs.diff || github.event_name == 'push'
76+
if: env.GIT_DIFF || github.event_name == 'push'
7977
- name: Get Yarn Cache Directory
8078
id: yarn-cache
8179
run: echo "::set-output name=dir::$(yarn cache dir)"
82-
if: steps.git-diff.outputs.diff || github.event_name == 'push'
80+
if: env.GIT_DIFF || github.event_name == 'push'
8381
- name: Cache node dependencies
8482
uses: actions/cache@v1
8583
with:
8684
path: ${{ steps.yarn-cache.outputs.dir }}
8785
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
8886
restore-keys: |
8987
${{ runner.os }}-yarn-
90-
if: steps.git-diff.outputs.diff || github.event_name == 'push'
88+
if: env.GIT_DIFF || github.event_name == 'push'
9189
- name: Install Package dependencies
9290
run: yarn install
93-
if: steps.git-diff.outputs.diff || github.event_name == 'push'
91+
if: env.GIT_DIFF || github.event_name == 'push'
9492
- name: Run tests
9593
run: yarn cover
96-
if: steps.git-diff.outputs.diff || github.event_name == 'push'
94+
if: env.GIT_DIFF || github.event_name == 'push'
9795
- name: Codecov
9896
run: curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -f $COVERAGE_FILE
9997
env:
10098
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10199
COVERAGE_FILE: ./coverage/lcov.info
102-
if: matrix.node == '12' && (steps.git-diff.outputs.diff || github.event_name == 'push')
100+
if: matrix.node == '12' && (env.GIT_DIFF || github.event_name == 'push')
103101
- uses: 8398a7/action-slack@v1
104102
with:
105103
type: failure

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,18 @@ jobs:
4141
with:
4242
fetch-depth: 3
4343
- uses: technote-space/get-diff-action@v1
44-
id: git-diff
4544
with:
4645
PREFIX_FILTER: |
4746
src
4847
__tests__
4948
SUFFIX_FILTER: .ts
5049
- name: Install Package dependencies
5150
run: yarn install
52-
if: steps.git-diff.outputs.diff
51+
if: env.GIT_DIFF
5352
- name: Check code style
5453
# Check only the source codes that have differences
55-
run: yarn eslint ${{ steps.git-diff.outputs.diff }}
56-
if: steps.git-diff.outputs.diff
54+
run: yarn eslint ${{ env.GIT_DIFF }}
55+
if: env.GIT_DIFF
5756
```
5857
5958
If there is no difference in the source code below, this workflow will skip the code style check

__tests__/utils/command.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe('getGitDiff', () => {
5454
process.env.INPUT_PREFIX_FILTER = 'src/\n__tests__';
5555
process.env.INPUT_SUFFIX_FILTER = '.ts\n.txt';
5656
process.env.INPUT_ABSOLUTE = 'false';
57+
process.env.INPUT_SET_ENV_NAME = '';
5758
const mockExec = spyOnExec();
5859
setChildProcessParams({
5960
stdout: (command: string): string => {

__tests__/utils/misc.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ describe('setResult', () => {
6464

6565
stdoutCalledWith(mockStdout, [
6666
'::set-output name=diff::test1 test2',
67+
'::set-env name=GIT_DIFF::test1 test2',
6768
]);
6869
});
6970

70-
it('should set result with env', () => {
71-
process.env.INPUT_SET_ENV_NAME = 'DIFF';
71+
it('should set result without env', () => {
72+
process.env.INPUT_SET_ENV_NAME = '';
7273
const mockStdout = spyOnStdout();
7374

7475
setResult(['test1', 'test2']);
7576

7677
stdoutCalledWith(mockStdout, [
7778
'::set-output name=diff::test1 test2',
78-
'::set-env name=DIFF::test1 test2',
7979
]);
8080
});
8181
});

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ inputs:
3838
required: false
3939
SET_ENV_NAME:
4040
description: Env name.
41+
default: GIT_DIFF
4142
required: false
4243
outputs:
4344
diff:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/get-diff-action",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "GitHub actions to get git diff.",
55
"author": "Technote <[email protected]> (https://technote.space)",
66
"license": "MIT",

0 commit comments

Comments
 (0)