-
Notifications
You must be signed in to change notification settings - Fork 86
79 lines (66 loc) · 2.69 KB
/
test_url.yaml
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
name: Add message on pull requests with the related examples
on:
pull_request_target:
types:
- opened
jobs:
all:
name: Add message on pull requests with the related examples
runs-on: ubuntu-22.04
timeout-minutes: 2
steps:
- run: env
- name: GitHub event
run: echo ${GITHUB_EVENT} | python3 -m json.tool
env:
GITHUB_EVENT: ${{ toJson(github) }}
- name: GitHub event file
run: cat ${GITHUB_EVENT_PATH}
- run: npm install @actions/github
- run: |
echo "
const github = require('@actions/github');
async function run() {
// Get client and context
const client = new github.getOctokit(process.env.GITHUB_TOKEN);
await client.rest.pulls.createReview({
owner: github.context.issue.owner,
repo: github.context.issue.repo,
pull_number: github.context.issue.number,
body: [
'Examples: https://camptocamp.github.io/ngeo/refs/pull/${{github.event.number}}/merge/examples/',
'Storybook: https://camptocamp.github.io/ngeo/refs/pull/${{github.event.number}}/merge/storybook/',
'API help: https://camptocamp.github.io/ngeo/refs/pull/${{github.event.number}}/merge/api/apihelp/apihelp.html',
'API documentation: https://camptocamp.github.io/ngeo/refs/pull/${{github.event.number}}/merge/apidoc/',
].join('\n'),
event: 'COMMENT'
});
}
run();
" > pr-message.js
if: github.actor != 'dependabot[bot]'
- run: |
echo "
const github = require('@actions/github');
async function run() {
// Get client and context
const client = new github.getOctokit(process.env.GITHUB_TOKEN);
await client.rest.pulls.createReview({
owner: github.context.issue.owner,
repo: github.context.issue.repo,
pull_number: github.context.issue.number,
body: [
\"This build can't have the Chromatic status because the secrets are missing.\",
\"To get the Chromatic status check you should assign one label, e.-g. \`get-chromatic-on-dependabot\`.\",
\"You can also check the status on https://www.chromatic.com/pullrequests?appId=612f928164063b003a629e5b.\"
].join('\n'),
event: 'COMMENT'
});
}
run();
" > pr-message.js
if: github.actor == 'dependabot[bot]'
- run: cat pr-message.js
- run: node pr-message.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}