Skip to content

Commit ed77be0

Browse files
Merge pull request #237 from technote-space/chore/chore-sync-workflows
chore: sync workflows
2 parents d73cbd8 + 9473aed commit ed77be0

File tree

7 files changed

+98
-34
lines changed

7 files changed

+98
-34
lines changed

.github/pull_request_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<!-- Detail of changes (please add screenshots if applicable) -->
77
<!-- ビューの変更がある場合はスクショによる比較などがあるとわかりやすい -->
88

9+
<!-- START pr-commits -->
10+
<!-- END pr-commits -->
11+
912
## Expected Impact: 影響範囲
1013
<!-- e.g. I changed this function, which might be affect that function. -->
1114
<!-- この関数を変更したのでこの機能にも影響がある、など -->

.github/workflows/add-version-tag.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ on:
77
name: Add version tag
88

99
jobs:
10-
release:
10+
tag:
11+
name: Add version tag
1112
runs-on: ubuntu-latest
12-
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
13+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
1314
steps:
1415
- name: Get version
1516
run: echo "::set-env name=TAG_NAME::${HEAD_REF#release/}"

.github/workflows/check-version.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,57 +141,67 @@ jobs:
141141
matrix:
142142
target: ['npm', 'gpr']
143143
steps:
144+
- name: Set running flag
145+
run: echo "::set-env name=RUNNING::1"
146+
- name: Set running flag
147+
run: |
148+
if [ -z "$NPM_AUTH_TOKEN" ]; then
149+
echo "::set-env name=RUNNING::"
150+
fi
151+
env:
152+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
153+
144154
- uses: actions/checkout@v2
155+
if: env.RUNNING
145156
- name: Setup Node.js
146157
uses: actions/setup-node@v1
147158
with:
148159
node-version: 12
149160
registry-url: https://registry.npmjs.org/
150-
if: matrix.target == 'npm'
161+
if: env.RUNNING && matrix.target == 'npm'
151162
- name: Setup Node.js
152163
uses: actions/setup-node@v1
153164
with:
154165
node-version: 12
155166
registry-url: https://npm.pkg.github.com
156-
if: matrix.target == 'gpr'
167+
if: env.RUNNING && matrix.target == 'gpr'
157168
- name: Get Yarn Cache Directory
158169
id: yarn-cache
159170
run: echo "::set-output name=dir::$(yarn cache dir)"
171+
if: env.RUNNING
160172
- name: Cache node dependencies
161173
uses: actions/cache@v1
162174
with:
163175
path: ${{ steps.yarn-cache.outputs.dir }}
164176
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
165177
restore-keys: |
166178
${{ runner.os }}-yarn-
167-
179+
if: env.RUNNING
168180
- name: Check package version
169181
uses: technote-space/package-version-check-action@v1
170182
with:
171183
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172184
COMMIT_DISABLED: 1
185+
if: env.RUNNING
173186
- name: Install Package dependencies
174187
run: yarn install
188+
if: env.RUNNING
175189
- name: Build
176190
run: yarn build
191+
if: env.RUNNING
177192
- name: Publish
178193
run: |
179-
if [ -n "$NPM_AUTH_TOKEN" ]; then
180-
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
181-
npm publish
182-
fi
194+
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
195+
npm publish
183196
env:
184197
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
185-
if: matrix.target == 'npm'
198+
if: env.RUNNING && matrix.target == 'npm'
186199
- name: Publish
187200
run: |
188-
if [ -n "$NPM_AUTH_TOKEN" ]; then
189-
npm publish
190-
fi
201+
npm publish
191202
env:
192203
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193-
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
194-
if: matrix.target == 'gpr'
204+
if: env.RUNNING && matrix.target == 'gpr'
195205
- uses: 8398a7/action-slack@v2
196206
with:
197207
status: failure

.github/workflows/pr-opened.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,24 @@ jobs:
3333
uses: technote-space/pr-labeler-action@v3
3434
with:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
checkVersion:
38+
name: Check package version
39+
runs-on: ubuntu-latest
40+
if: startsWith(github.event.pull_request.head.ref, 'release/')
41+
steps:
42+
- name: Set running flag
43+
run: echo "::set-env name=RUNNING::1"
44+
- uses: actions/checkout@v2
45+
- name: Set running flag
46+
run: |
47+
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
48+
echo "::set-env name=RUNNING::"
49+
fi
50+
51+
- name: Check package version
52+
uses: technote-space/package-version-check-action@v1
53+
with:
54+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
55+
BRANCH_PREFIX: release/
56+
if: env.RUNNING

.github/workflows/pr-updated.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1-
on: pull_request
1+
on:
2+
pull_request:
3+
types: [opened, synchronize]
24

35
name: Pull Request updated
46

57
jobs:
68
triage:
79
name: Pull Request Labeler
810
runs-on: ubuntu-latest
9-
if: "! startsWith(github.event.pull_request.head.ref, 'release/v')"
11+
if: "! startsWith(github.event.pull_request.head.ref, 'release/')"
1012
steps:
1113
- name: Pull Request Labeler
1214
uses: actions/labeler@v2
1315
with:
1416
repo-token: ${{ secrets.GITHUB_TOKEN }}
1517

18+
history:
19+
name: Pull Request Body
20+
runs-on: ubuntu-latest
21+
if: startsWith(github.event.pull_request.head.ref, 'release/')
22+
steps:
23+
- name: Pull Request Body
24+
uses: technote-space/pr-commit-body-action@v1
25+
with:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
EXCLUDE_MESSAGES: |
28+
trigger workflow
29+
Update TOC
30+
Update package version
31+
1632
assignToProject:
1733
name: Assign PullRequest to Project
1834
runs-on: ubuntu-latest
35+
if: github.event.action == 'synchronize'
1936
steps:
2037
- uses: actions/checkout@v2
2138
- uses: technote-space/get-git-comment-action@v1
@@ -31,6 +48,7 @@ jobs:
3148
assignAuthor:
3249
name: Assign author to PR
3350
runs-on: ubuntu-latest
51+
if: github.event.action == 'synchronize'
3452
steps:
3553
- uses: actions/checkout@v2
3654
- uses: technote-space/get-git-comment-action@v1
@@ -44,6 +62,7 @@ jobs:
4462
addLabelsByBranch:
4563
name: PR Labeler
4664
runs-on: ubuntu-latest
65+
if: github.event.action == 'synchronize'
4766
steps:
4867
- uses: actions/checkout@v2
4968
- uses: technote-space/get-git-comment-action@v1
@@ -53,3 +72,29 @@ jobs:
5372
with:
5473
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5574
IGNORE_CONTEXT_CHECK: true
75+
76+
checkVersion:
77+
name: Check package version
78+
runs-on: ubuntu-latest
79+
if: github.event.action == 'synchronize' && startsWith(github.event.pull_request.head.ref, 'release/')
80+
steps:
81+
- name: Set running flag
82+
run: echo "::set-env name=RUNNING::"
83+
- uses: actions/checkout@v2
84+
- uses: technote-space/get-git-comment-action@v1
85+
- name: Set running flag
86+
run: echo "::set-env name=RUNNING::1"
87+
if: contains(env.COMMIT_MESSAGE, 'trigger workflow')
88+
- name: Set running flag
89+
run: |
90+
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
91+
echo "::set-env name=RUNNING::"
92+
fi
93+
94+
- name: Check package version
95+
uses: technote-space/package-version-check-action@v1
96+
with:
97+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
98+
BRANCH_PREFIX: release/
99+
IGNORE_CONTEXT_CHECK: true
100+
if: env.RUNNING

.github/workflows/sync-workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
schedule:
3-
- cron: 0 15 * * 4
3+
- cron: 0 12 * * 4
44
repository_dispatch:
55
types: [sync-workflows]
66

0 commit comments

Comments
 (0)