forked from mirror/misskey
Display the deploy status on checks (#8803)
* Display deploy status on check suite * Display deploy status on check suite * fix * fix
This commit is contained in:
parent
79de4d77f6
commit
065aa0f9b6
57
.github/workflows/pr-preview-deploy.yml
vendored
57
.github/workflows/pr-preview-deploy.yml
vendored
@ -1,5 +1,7 @@
|
|||||||
# Run secret-dependent integration tests only after /deploy approval
|
# Run secret-dependent integration tests only after /deploy approval
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
repository_dispatch:
|
repository_dispatch:
|
||||||
types: [deploy-command]
|
types: [deploy-command]
|
||||||
|
|
||||||
@ -14,6 +16,43 @@ jobs:
|
|||||||
github.event.client_payload.slash_command.sha != '' &&
|
github.event.client_payload.slash_command.sha != '' &&
|
||||||
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
|
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/github-script@v5
|
||||||
|
id: check-id
|
||||||
|
env:
|
||||||
|
number: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
job: ${{ github.job }}
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
result-encoding: string
|
||||||
|
script: |
|
||||||
|
const { data: pull } = await github.rest.pulls.get({
|
||||||
|
...context.repo,
|
||||||
|
pull_number: process.env.number
|
||||||
|
});
|
||||||
|
const ref = pull.head.sha;
|
||||||
|
|
||||||
|
const { data: checks } = await github.rest.checks.listForRef({
|
||||||
|
...context.repo,
|
||||||
|
ref
|
||||||
|
});
|
||||||
|
|
||||||
|
const check = checks.check_runs.filter(c => c.name === process.env.job);
|
||||||
|
|
||||||
|
return check[0].id;
|
||||||
|
|
||||||
|
- uses: actions/github-script@v5
|
||||||
|
env:
|
||||||
|
check_id: ${{ steps.check-id.outputs.result }}
|
||||||
|
details_url: ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.run_id }}
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
await github.rest.checks.update({
|
||||||
|
...context.repo,
|
||||||
|
check_run_id: process.env.check_id,
|
||||||
|
status: 'in_progress',
|
||||||
|
details_url: process.env.details_url
|
||||||
|
});
|
||||||
|
|
||||||
# Check out merge commit
|
# Check out merge commit
|
||||||
- name: Fork based /deploy checkout
|
- name: Fork based /deploy checkout
|
||||||
@ -40,29 +79,15 @@ jobs:
|
|||||||
id: update-check-run
|
id: update-check-run
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
env:
|
env:
|
||||||
number: ${{ github.event.client_payload.pull_request.number }}
|
|
||||||
job: ${{ github.job }}
|
|
||||||
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
|
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
|
||||||
conclusion: ${{ job.status }}
|
conclusion: ${{ job.status }}
|
||||||
|
check_id: ${{ steps.check-id.outputs.result }}
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const { data: pull } = await github.rest.pulls.get({
|
|
||||||
...context.repo,
|
|
||||||
pull_number: process.env.number
|
|
||||||
});
|
|
||||||
const ref = pull.head.sha;
|
|
||||||
|
|
||||||
const { data: checks } = await github.rest.checks.listForRef({
|
|
||||||
...context.repo,
|
|
||||||
ref
|
|
||||||
});
|
|
||||||
|
|
||||||
const check = checks.check_runs.filter(c => c.name === process.env.job);
|
|
||||||
|
|
||||||
const { data: result } = await github.rest.checks.update({
|
const { data: result } = await github.rest.checks.update({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
check_run_id: check[0].id,
|
check_run_id: process.env.check_id,
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
conclusion: process.env.conclusion
|
conclusion: process.env.conclusion
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user