generated from actions/hello-world-docker-action
-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (183 loc) · 5.73 KB
/
pull_request.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: "Pull Request"
on:
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: "Install"
run: |
npm install
- name: "Prettier"
run: |
npm run format-check
- name: "Lint"
run: |
npm run lint
- name: "Test"
run: |
npm run test
- name: "build"
run: |
npm run build
npm run package
test:
runs-on: ubuntu-24.04
env:
EMAIL_INPUT: [email protected]
USERNAME_INPUT: example-test
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: "Build action for test"
run: |
npm install
npm run build
npm run package
git clean -fXd
- uses: webiny/[email protected]
with:
run: .github/scripts/test_post.sh
- name: Test executing the action
uses: ./
env:
GIT_DEPLOY_KEY: not-a-real-key
AUTH_TOKEN_STRING: |
email = [email protected]
with:
email: ${{ env.EMAIL_INPUT }}
username: ${{ env.USERNAME_INPUT }}
- run: |
set -u
cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa"
echo
git config user.name
git config user.email
git remote get-url origin
git config core.sshCommand
grep '^github\.com' "$RUNNER_TEMP/setup-npm-publish-action/known_hosts"
[[ "$(cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa")" == "not-a-real-key" ]]
[[ "$(git config user.name)" == "${{ env.USERNAME_INPUT }}" ]]
[[ "$(git config user.email)" == "${{ env.EMAIL_INPUT }}" ]]
[[ "$(git remote get-url origin)" == "[email protected]:$GITHUB_REPOSITORY.git" ]]
# Just check that it is altered from default
[[ "$(git config core.sshCommand)" == *UserKnownHostsFile* ]]
test-cleanup-non-repo:
runs-on: ubuntu-24.04
env:
EMAIL_INPUT: [email protected]
USERNAME_INPUT: example-test
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: "Build action for test"
run: |
npm install
npm run build
npm run package
git clean -fXd
- uses: webiny/[email protected]
with:
run: .github/scripts/test_missing_npmrc_post.sh
- name: Test executing the action
uses: ./
env:
GIT_DEPLOY_KEY: not-a-real-key
AUTH_TOKEN_STRING: |
email = [email protected]
with:
email: ${{ env.EMAIL_INPUT }}
username: ${{ env.USERNAME_INPUT }}
- run: |
set -u
cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa"
echo
git config user.name
git config user.email
git remote get-url origin
git config core.sshCommand
grep '^github\.com' "$RUNNER_TEMP/setup-npm-publish-action/known_hosts"
[[ "$(cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa")" == "not-a-real-key" ]]
[[ "$(git config user.name)" == "${{ env.USERNAME_INPUT }}" ]]
[[ "$(git config user.email)" == "${{ env.EMAIL_INPUT }}" ]]
[[ "$(git remote get-url origin)" == "[email protected]:$GITHUB_REPOSITORY.git" ]]
# Just check that it is altered from default
[[ "$(git config core.sshCommand)" == *UserKnownHostsFile* ]]
- run: rm -rf .git
test-missing-npmrc:
runs-on: ubuntu-24.04
env:
EMAIL_INPUT: [email protected]
USERNAME_INPUT: example-test
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: "Build action for test"
run: |
npm install
npm run build
npm run package
git clean -fXd
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Testing"
git rm .npmrc
git commit -m "mark removed npmrc file"
- uses: webiny/[email protected]
with:
run: .github/scripts/test_missing_npmrc_post.sh
- name: Test executing the action
uses: ./
env:
GIT_DEPLOY_KEY: not-a-real-key
AUTH_TOKEN_STRING: |
email = [email protected]
with:
email: ${{ env.EMAIL_INPUT }}
username: ${{ env.USERNAME_INPUT }}
- run: |
set -u
cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa"
echo
git config user.name
git config user.email
git remote get-url origin
git config core.sshCommand
grep '^github\.com' "$RUNNER_TEMP/setup-npm-publish-action/known_hosts"
[[ "$(cat "$RUNNER_TEMP/setup-npm-publish-action/id_rsa")" == "not-a-real-key" ]]
[[ "$(git config user.name)" == "${{ env.USERNAME_INPUT }}" ]]
[[ "$(git config user.email)" == "${{ env.EMAIL_INPUT }}" ]]
[[ "$(git remote get-url origin)" == "[email protected]:$GITHUB_REPOSITORY.git" ]]
# Just check that it is altered from default
[[ "$(git config core.sshCommand)" == *UserKnownHostsFile* ]]
release:
runs-on: ubuntu-24.04
name: "Build and release action"
needs: [build, test, test-cleanup-non-repo, test-missing-npmrc]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Configure git
uses: smartlyio/github-actions@git-init-userinfo-v1
- name: Release flow
uses: smartlyio/github-actions@release-action-node-v1
with:
dry_run: true
token: "${{ secrets.GITHUB_TOKEN }}"