-
-
Notifications
You must be signed in to change notification settings - Fork 25
153 lines (149 loc) · 5.26 KB
/
test.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
on:
push:
branches:
- master
pull_request_target:
types:
- opened
- synchronize
workflow_dispatch: {}
name: Test
jobs:
# use no configuration. Will update existing pull request:
# https://github.com/gr2m/create-or-update-pull-request-action/pull/2
happyPath:
name: "[TEST] Update existing pull request"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: "date > test.txt"
- run: "npm ci"
- run: "npm run build"
- uses: ./
id: run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
commit-message: "Just testing [skip ci]"
- if: ${{ steps.run.outputs.result != 'updated' || steps.run.outputs.pull-request-number > 0 }}
run: 'echo "Output of action is not as expected" && exit 1'
createNewPullRequest:
name: "[TEST] Create new pull request"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: "date > test.txt"
- run: "npm ci"
- run: "npm run build"
- uses: ./
id: run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
title: Test pull request
body: This pull request is part of the CI - please ignore.
branch: test-create-new-pull-request
commit-message: "Just testing [skip ci]"
author: "J. Doe <[email protected]>"
labels: test1, test2
assignees: gr2m
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-create-new-pull-request"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.run.outputs.result != 'created' }}
run: 'echo "result output is \"${{ steps.run.outputs.result }}\" but expected \"created\"" && exit 1'
- if: ${{ steps.run.outputs.pull-request-number > 0 }}
run: 'echo "pull-request-number output is \"${{ steps.run.outputs.pull-request-number }}\" but expected a number" && exit 1'
multipleCommits:
name: "[TEST] Create multiple commits"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: "date > file1.txt"
- run: "date > file2.txt"
- run: "npm ci"
- run: "npm run build"
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
title: Test pull request with multiple commits
body: This pull request is part of the CI - please ignore.
branch: test-create-new-pull-request-with-multiple-commits
author: "J. Doe <[email protected]>"
path: file1.txt
commit-message: "file 1 created [skip ci]"
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
title: Test pull request
body: This pull request is part of the CI - please ignore.
branch: test-create-new-pull-request-with-multiple-commits
author: "J. Doe <[email protected]>"
path: file2.txt
commit-message: "file 2 created [skip ci]"
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
title: Test pull request
body: This pull request is part of the CI - please ignore.
branch: test-create-new-pull-request-with-multiple-commits
author: "J. Doe <[email protected]>"
path: does_not_exist.txt
commit-message: "this should fail silently, not commit should be created"
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-create-new-pull-request-with-multiple-commits"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
autoMerge:
name: "[TEST] Auto merge"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: "date > test.txt"
- run: "npm ci"
- run: "npm run build"
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
title: Test pull request for `auto-merge` option
commit-message: "Testing auto-merge"
auto-merge: squash
branch: test-auto-merge
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-auto-merge"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# expect to detect changes in a hidden file:
# https://github.com/gr2m/create-or-update-pull-request-action/pull/262
hiddenFile:
name: "[TEST] Create or update pull request for hidden file"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: "date > .github/test.txt"
- run: "npm ci"
- run: "npm run build"
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_STEP_DEBUG: true
with:
commit-message: "Just testing [skip ci]"