forked from koluku/sudden-death
-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (78 loc) · 2.74 KB
/
pr-check-npm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
name: pr-check-npm
on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
push:
branches:
- master
- develop
permissions:
contents: write
pull-requests: write
jobs:
pr-update-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/[email protected]
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
cache: npm
- name: Get npm version
id: get_npm_version
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/pr_check_npm/pr_update_version/get_npm_version.sh"
- uses: dev-hato/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
branch-name-prefix: fix-version
pr-title-prefix: nodeをアップデートしてあげたよ!
# package.jsonに差分があれば、package.jsonからpackage-lock.jsonを作り出す
pr-check-npm:
runs-on: ubuntu-latest
needs: pr-update-version
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
# ここでsubmodule持ってくるとdetached headにcommitして死ぬ
# submodule: 'recursive'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Node.js
uses: actions/[email protected]
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
cache: npm
- name: Install dependencies
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/pr_check_npm/npm_install.sh"
- uses: dev-hato/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
branch-name-prefix: npm
pr-title-prefix: package.jsonやpackage-lock.jsonが更新されたので直してあげたよ!
pr-check-npm-complete:
runs-on: ubuntu-latest
if: always()
needs: pr-check-npm
steps:
- if: needs.pr-check-npm.result == 'success'
run: exit 0
- if: needs.pr-check-npm.result != 'success'
run: exit 1
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true