Skip to content

Commit 94640f7

Browse files
ci: cleanup pr-revision tags on PR closure (#1622)
1 parent 51796ca commit 94640f7

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.coderabbit.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ reviews:
1818
- '!**/*.md'
1919
- '!**/*.txt'
2020
- '!**/*.lock'
21+
- '!**/*.conf'
2122
chat:
2223
auto_reply: true

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,11 @@ jobs:
139139
with:
140140
url: ${{ needs.deploy-web-pr.outputs.preview_url }}
141141
secrets: inherit
142+
143+
cleanup-pr-revision-web:
144+
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'main' && github.event.action == 'closed' }}
145+
uses: ./.github/workflows/cleanup_feature_revision.yml
146+
with:
147+
service: reearth-visualizer-web
148+
tag: pr-${{ github.event.pull_request.number }}
149+
secrets: inherit
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Remove PR Cloud Run Revision Tags
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
service:
7+
description: 'Service name to remove revision tags.'
8+
type: string
9+
required: true
10+
tag:
11+
description: 'Revision tag to remove.'
12+
type: string
13+
required: true
14+
workflow_call:
15+
inputs:
16+
service:
17+
description: 'Service name to remove revision tags.'
18+
type: string
19+
required: true
20+
tag:
21+
description: 'Revision tag to remove.'
22+
type: string
23+
required: true
24+
25+
jobs:
26+
remove-revision-tags:
27+
runs-on: ubuntu-latest
28+
if: github.event.repository.full_name == 'reearth/reearth-visualizer'
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Authenticate to Google Cloud
34+
uses: google-github-actions/auth@v2
35+
with:
36+
service_account: ${{ secrets.GC_SA_EMAIL }}
37+
workload_identity_provider: ${{ secrets.GC_WORKLOAD_IDENTITY_PROVIDER }}
38+
39+
- name: Set up Cloud SDK
40+
uses: google-github-actions/setup-gcloud@v2
41+
42+
- name: Remove revision tags
43+
run: |
44+
gcloud run services update-traffic ${{ inputs.service }} \
45+
--region ${{ secrets.GC_REGION }} \
46+
--remove-tags=${{ inputs.tag }} || echo "Warning: Failed to remove tag ${{ inputs.tag }} - it may not exist"

0 commit comments

Comments
 (0)