[Backport master] Fix child notification #3658
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |