Skip to content

Commit f54711b

Browse files
Merge pull request #185 from technote-space/chore/chore-sync-workflows
chore: sync workflows
2 parents 877915f + 485067d commit f54711b

File tree

9 files changed

+128
-74
lines changed

9 files changed

+128
-74
lines changed

.github/workflows/add-version-tag.yml renamed to .github/workflows/add-release-tag.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@ on:
44
- master
55
types: [closed]
66

7-
name: Add version tag
7+
name: Add release tag
88

99
jobs:
1010
tag:
11-
name: Add version tag
11+
name: Add release tag
1212
runs-on: ubuntu-latest
13-
if: github.event.pull_request.merged == true && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/')
13+
if: github.event.pull_request.merged == true && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
1414
steps:
1515
- name: Get version
1616
uses: technote-space/get-next-version-action@v1
1717
with:
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
if: "! startsWith(github.event.pull_request.head.ref, 'release/v')"
18+
EXCLUDE_MESSAGES: |
19+
update package version
20+
update packages
21+
if: "! startsWith(github.head_ref, 'release/v')"
2022
- name: Get version
2123
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
2224
env:
23-
HEAD_REF: ${{ github.event.pull_request.head.ref }}
24-
if: startsWith(github.event.pull_request.head.ref, 'release/v')
25+
HEAD_REF: ${{ github.head_ref }}
26+
if: startsWith(github.head_ref, 'release/v')
2527
- uses: actions/github-script@0.4.0
2628
with:
2729
github-token: ${{ secrets.ACCESS_TOKEN }}
@@ -33,3 +35,14 @@ jobs:
3335
sha: context.sha
3436
})
3537
if: env.NEXT_VERSION
38+
- uses: actions/github-script@0.4.0
39+
with:
40+
github-token: ${{ secrets.ACCESS_TOKEN }}
41+
script: |
42+
github.git.createRef({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
ref: `refs/heads/release/next-${process.env.NEXT_VERSION}`,
46+
sha: context.sha
47+
})
48+
if: env.NEXT_VERSION
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on:
2+
schedule:
3+
- cron: 0 0 1 * *
4+
repository_dispatch:
5+
types: [check-link]
6+
7+
name: Broken Link Check
8+
jobs:
9+
check:
10+
name: Broken Link Check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: technote-space/auto-cancel-redundant-job@v1
14+
with:
15+
EXCLUDE_MERGED: 'true'
16+
- name: Broken Link Check
17+
uses: technote-space/broken-link-checker-action@v1

.github/workflows/ci.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ jobs:
99
env:
1010
LINT: 1
1111
steps:
12+
- uses: technote-space/auto-cancel-redundant-job@v1
13+
with:
14+
EXCLUDE_MERGED: 'true'
1215
- name: Set running flag
1316
run: echo "::set-env name=RUNNING::1"
1417
- uses: actions/checkout@v2
1518
- uses: technote-space/get-git-comment-action@v1
1619
- uses: technote-space/get-diff-action@v1
1720
with:
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1921
PREFIX_FILTER: |
2022
src/
2123
__tests__/
@@ -64,7 +66,6 @@ jobs:
6466
- uses: technote-space/get-git-comment-action@v1
6567
- uses: technote-space/get-diff-action@v1
6668
with:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6869
PREFIX_FILTER: |
6970
src/
7071
__tests__/
@@ -142,9 +143,22 @@ jobs:
142143
fi
143144
env:
144145
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
145-
146146
- uses: actions/checkout@v2
147147
if: env.RUNNING
148+
- name: Set running flag
149+
run: npx can-npm-publish || echo "::set-env name=RUNNING::"
150+
if: env.RUNNING && matrix.target == 'npm'
151+
- name: Set running flag
152+
run: |
153+
LATEST=`npm view . version`
154+
CURRENT=`cat package.json | jq -r .version`
155+
if [ "$LATEST" = "$CURRENT" ]; then
156+
echo "::set-env name=RUNNING::"
157+
fi
158+
env:
159+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
if: env.RUNNING && matrix.target == 'gpr'
161+
148162
- name: Setup Node.js
149163
uses: actions/setup-node@v1
150164
with:
@@ -172,7 +186,6 @@ jobs:
172186
- name: Check package version
173187
uses: technote-space/package-version-check-action@v1
174188
with:
175-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176189
COMMIT_DISABLED: 1
177190
if: env.RUNNING
178191
- name: Install Package dependencies
@@ -259,8 +272,6 @@ jobs:
259272
with:
260273
files: build/index.js
261274
draft: true
262-
env:
263-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
264275

265276
publishRelease:
266277
name: Create Release
@@ -295,8 +306,6 @@ jobs:
295306
if: always()
296307
steps:
297308
- uses: technote-space/workflow-conclusion-action@v1
298-
with:
299-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300309
- uses: 8398a7/action-slack@v2
301310
with:
302311
status: failure

.github/workflows/issue-opened.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ jobs:
99
name: Assign issues to project
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Assign issues to project
13-
uses: technote-space/create-project-card-action@v1
12+
- uses: technote-space/create-project-card-action@v1
1413
with:
1514
PROJECT: Backlog
1615
COLUMN: To do
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1816

1917
assignAuthor:
2018
name: Assign author to issue
2119
runs-on: ubuntu-latest
2220
steps:
23-
- name: Assign author to issue
24-
uses: technote-space/assign-author@v1
25-
with:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
- uses: technote-space/assign-author@v1

.github/workflows/pr-opened.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ jobs:
1010
name: Assign PullRequest to Project
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Assign PullRequest to Project
14-
uses: technote-space/create-project-card-action@v1
13+
- uses: technote-space/create-project-card-action@v1
1514
with:
1615
PROJECT: Backlog
1716
COLUMN: In progress
@@ -21,37 +20,10 @@ jobs:
2120
name: Assign author to PR
2221
runs-on: ubuntu-latest
2322
steps:
24-
- name: Assign Author to PR
25-
uses: technote-space/assign-author@v1
26-
with:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- uses: technote-space/assign-author@v1
2824

2925
addLabelsByBranch:
3026
name: PR Labeler
3127
runs-on: ubuntu-latest
3228
steps:
33-
- name: PR Labeler
34-
uses: technote-space/pr-labeler-action@v3
35-
with:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
38-
checkVersion:
39-
name: Check package version
40-
runs-on: ubuntu-latest
41-
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/v')
42-
steps:
43-
- name: Set running flag
44-
run: echo "::set-env name=RUNNING::1"
45-
- uses: actions/checkout@v2
46-
- name: Set running flag
47-
run: |
48-
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
49-
echo "::set-env name=RUNNING::"
50-
fi
51-
52-
- name: Check package version
53-
uses: technote-space/package-version-check-action@v1
54-
with:
55-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
56-
BRANCH_PREFIX: release/
57-
if: env.RUNNING
29+
- uses: technote-space/pr-labeler-action@v3

.github/workflows/pr-updated.yml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
on:
2-
pull_request:
3-
types: [opened, synchronize]
1+
on: pull_request
42

53
name: Pull Request updated
64

75
jobs:
86
triage:
97
name: Pull Request Labeler
108
runs-on: ubuntu-latest
11-
if: "! startsWith(github.event.pull_request.head.ref, 'release/')"
9+
if: "! startsWith(github.head_ref, 'release/')"
1210
steps:
13-
- name: Pull Request Labeler
14-
uses: actions/labeler@v2
11+
- uses: actions/labeler@v2
1512
with:
1613
repo-token: ${{ secrets.GITHUB_TOKEN }}
1714

@@ -20,26 +17,23 @@ jobs:
2017
runs-on: ubuntu-latest
2118
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id
2219
steps:
23-
- name: Pull Request Body
24-
uses: technote-space/pr-commit-body-action@v1
20+
- uses: technote-space/pr-commit-body-action@v1
2521
with:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2722
EXCLUDE_MESSAGES: |
2823
trigger workflow
2924
update TOC
3025
update package version
3126
update wp version
3227
TITLE: '## Changes'
33-
LINK_ISSUE_KEYWORD: ${{ (startsWith(github.event.pull_request.head.ref, 'release/') && 'closes') || '' }}
28+
LINK_ISSUE_KEYWORD: ${{ (startsWith(github.head_ref, 'release/') && 'closes') || '' }}
3429
FILTER_PR: true
3530

3631
manageRelease:
3732
name: Manage release
3833
runs-on: ubuntu-latest
39-
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/') && ! startsWith(github.event.pull_request.head.ref, 'release/v')"
34+
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/') && ! startsWith(github.head_ref, 'release/v')"
4035
steps:
41-
- name: Manage release
42-
uses: technote-space/release-type-action@v1
36+
- uses: technote-space/release-type-action@v1
4337
with:
4438
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
4539
EXCLUDE_MESSAGES: |
@@ -49,7 +43,7 @@ jobs:
4943
checkVersion:
5044
name: Check package version
5145
runs-on: ubuntu-latest
52-
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/') && ! startsWith(github.event.pull_request.head.ref, 'release/v')"
46+
if: "github.event.action == 'synchronize' && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/') && ! startsWith(github.head_ref, 'release/v')"
5347
steps:
5448
- name: Set running flag
5549
run: echo "::set-env name=RUNNING::1"
@@ -63,7 +57,9 @@ jobs:
6357
- name: Get version
6458
uses: technote-space/get-next-version-action@v1
6559
with:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
EXCLUDE_MESSAGES: |
61+
update package version
62+
update packages
6763
if: env.RUNNING
6864
- name: Check package version
6965
uses: technote-space/package-version-check-action@v1
@@ -72,3 +68,23 @@ jobs:
7268
BRANCH_PREFIX: release/
7369
NEXT_VERSION: ${{ env.NEXT_VERSION }}
7470
if: env.NEXT_VERSION
71+
72+
checkPublish:
73+
name: Check publish
74+
runs-on: ubuntu-latest
75+
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')"
76+
steps:
77+
- name: Set running flag
78+
run: echo "::set-env name=RUNNING::1"
79+
- name: Set running flag
80+
run: |
81+
if [ -z "$NPM_AUTH_TOKEN" ]; then
82+
echo "::set-env name=RUNNING::"
83+
fi
84+
env:
85+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
86+
87+
- uses: actions/checkout@v2
88+
if: env.RUNNING
89+
- uses: technote-space/can-npm-publish-action@v1
90+
if: env.RUNNING

.github/workflows/project-card-moved.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ jobs:
99
name: Auto card labeler
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Auto card labeler
13-
uses: technote-space/auto-card-labeler@v1
14-
with:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
- uses: technote-space/auto-card-labeler@v1

.github/workflows/toc.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ jobs:
1010
name: TOC Generator
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: TOC Generator
14-
uses: technote-space/toc-generator@v2
13+
- uses: technote-space/toc-generator@v2
1514
with:
1615
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
1716
TARGET_BRANCH_PREFIX: release/

.github/workflows/update-dependencies.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
name: Update npm dependencies
1313
runs-on: ubuntu-latest
1414
steps:
15+
- uses: technote-space/auto-cancel-redundant-job@v1
16+
with:
17+
EXCLUDE_MERGED: 'true'
1518
- name: Update dependencies
19+
id: update_deps
1620
uses: technote-space/create-pr-action@v1
1721
with:
1822
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
@@ -29,3 +33,35 @@ jobs:
2933
PR_DEFAULT_BRANCH_TITLE: 'feat: release'
3034
TARGET_BRANCH_PREFIX: release/
3135
AUTO_MERGE_THRESHOLD_DAYS: 14
36+
37+
- name: Set running flag
38+
run: echo "::set-env name=RUNNING::"
39+
- name: Set running flag
40+
run: echo "::set-env name=RUNNING::1"
41+
if: steps.update_deps.outputs.result != 'succeeded' && github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
42+
- uses: actions/checkout@v2
43+
if: env.RUNNING
44+
- name: Set running flag
45+
run: |
46+
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
47+
echo "::set-env name=RUNNING::"
48+
fi
49+
- name: Get version
50+
uses: technote-space/get-next-version-action@v1
51+
with:
52+
EXCLUDE_MESSAGES: |
53+
update package version
54+
update packages
55+
if: "env.RUNNING && ! startsWith(github.head_ref, 'release/v')"
56+
- name: Get version
57+
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
58+
env:
59+
HEAD_REF: ${{ github.head_ref }}
60+
if: env.RUNNING && startsWith(github.head_ref, 'release/v')
61+
- name: Check package version
62+
uses: technote-space/package-version-check-action@v1
63+
with:
64+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
65+
BRANCH_PREFIX: release/
66+
NEXT_VERSION: ${{ env.NEXT_VERSION }}
67+
if: env.NEXT_VERSION

0 commit comments

Comments
 (0)