summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorMasaya Suzuki <15100604+massongit@users.noreply.github.com>2023-02-24 18:51:31 +0900
committerGitHub <noreply@github.com>2023-02-24 18:51:31 +0900
commita7943dceca7b958b194e07858699a65b8ed5c7a5 (patch)
tree901e5e0bda8447d4d190bdec31247cd03ec3a101 /.github/workflows
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadsharkey-a7943dceca7b958b194e07858699a65b8ed5c7a5.tar.gz
sharkey-a7943dceca7b958b194e07858699a65b8ed5c7a5.tar.bz2
sharkey-a7943dceca7b958b194e07858699a65b8ed5c7a5.zip
デプロイされているプレビュー環境がない場合はプレビュー環境を削除しないようにする (#10062)
* デプロイされているプレビュー環境がない場合はDestroy preview environmentを実行しないようにする * CIがない場合の処理追加
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/pr-preview-destroy.yml34
1 files changed, 33 insertions, 1 deletions
diff --git a/.github/workflows/pr-preview-destroy.yml b/.github/workflows/pr-preview-destroy.yml
index 49f1ba8a34..8adfad9dab 100644
--- a/.github/workflows/pr-preview-destroy.yml
+++ b/.github/workflows/pr-preview-destroy.yml
@@ -9,14 +9,46 @@ name: Destroy preview environment
jobs:
destroy-preview-environment:
runs-on: ubuntu-latest
- if: github.repository == github.event.pull_request.head.repo.full_name
steps:
+ - uses: actions/github-script@v6.3.3
+ id: check-conclusion
+ env:
+ number: ${{ github.event.number }}
+ 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 === 'deploy-preview-environment');
+
+ if (check.length === 0) {
+ return;
+ }
+
+ const { data: result } = await github.rest.checks.get({
+ ...context.repo,
+ check_run_id: check[0].id,
+ });
+
+ return result.conclusion;
- name: Context
+ if: steps.check-conclusion.outputs.result == 'success'
uses: okteto/context@latest
with:
token: ${{ secrets.OKTETO_TOKEN }}
- name: Destroy preview environment
+ if: steps.check-conclusion.outputs.result == 'success'
uses: okteto/destroy-preview@latest
with:
name: pr-${{ github.event.number }}-syuilo