summaryrefslogtreecommitdiff
path: root/.github/workflows/pr-preview-deploy.yml
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2022-06-09 05:49:00 +0900
committerGitHub <noreply@github.com>2022-06-09 05:49:00 +0900
commit065aa0f9b6f9a12c67dd2c0cfe338a78575b244b (patch)
treeeb3d97c5544340f9b76766fa62ac003d118329e3 /.github/workflows/pr-preview-deploy.yml
parentchore(dev): update okteto workflow (diff)
downloadsharkey-065aa0f9b6f9a12c67dd2c0cfe338a78575b244b.tar.gz
sharkey-065aa0f9b6f9a12c67dd2c0cfe338a78575b244b.tar.bz2
sharkey-065aa0f9b6f9a12c67dd2c0cfe338a78575b244b.zip
Display the deploy status on checks (#8803)
* Display deploy status on check suite * Display deploy status on check suite * fix * fix
Diffstat (limited to '.github/workflows/pr-preview-deploy.yml')
-rw-r--r--.github/workflows/pr-preview-deploy.yml57
1 files changed, 41 insertions, 16 deletions
diff --git a/.github/workflows/pr-preview-deploy.yml b/.github/workflows/pr-preview-deploy.yml
index 1b399264db..fd43bce9e6 100644
--- a/.github/workflows/pr-preview-deploy.yml
+++ b/.github/workflows/pr-preview-deploy.yml
@@ -1,5 +1,7 @@
# Run secret-dependent integration tests only after /deploy approval
on:
+ pull_request:
+ types: [opened, reopened, synchronize]
repository_dispatch:
types: [deploy-command]
@@ -14,6 +16,43 @@ jobs:
github.event.client_payload.slash_command.sha != '' &&
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
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
- name: Fork based /deploy checkout
@@ -40,29 +79,15 @@ jobs:
id: update-check-run
if: ${{ always() }}
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
conclusion: ${{ job.status }}
+ check_id: ${{ steps.check-id.outputs.result }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
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({
...context.repo,
- check_run_id: check[0].id,
+ check_run_id: process.env.check_id,
status: 'completed',
conclusion: process.env.conclusion
});