fix: thread_ts
is not always present
#14
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: Close Pull Request | |
on: | |
pull_request: | |
types: [ closed ] | |
jobs: | |
teardown_pr_environment: | |
name: Teardown Cloud Run PR environment | |
runs-on: ubuntu-latest | |
# Grant permissions to `GITHUB_TOKEN` for Google Cloud Workload Identity Provider | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: 'actions/checkout@v3' | |
- name: Authenticate to Google Cloud | |
uses: 'google-github-actions/auth@v1' | |
with: | |
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WIP }} | |
service_account: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT }} | |
- name: Set up Cloud SDK | |
uses: 'google-github-actions/setup-gcloud@v1' | |
with: | |
version: '>= 435.0.0' | |
- name: Get Docker image tag from GITHUB_REF | |
id: docker-image-tag-from-ref | |
uses: ./.github/actions/docker-image-tag-from-ref | |
- name: Remove PR environment if exists | |
run: | | |
service_name="argilla-quickstart-${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }}" | |
services=$(gcloud run services list --project=argilla-ci --format="value(metadata.name)") | |
if echo "$services" | grep -q "$service_name"; then | |
echo "Service '$service_name' exists. Removing it..." | |
gcloud run services delete $service_name --project=argilla-ci --region=europe-southwest1 --quiet | |
else | |
echo "Service $service_name does not exist." | |
fi |