Skip to content

[PAN-OS Upgrade Assurance][2.1.0-stage] documentation PREVIEW - do NOT MERGE #19

[PAN-OS Upgrade Assurance][2.1.0-stage] documentation PREVIEW - do NOT MERGE

[PAN-OS Upgrade Assurance][2.1.0-stage] documentation PREVIEW - do NOT MERGE #19

name: "Cleanup Preview"
on:
pull_request_target:
types: [closed]
permissions: {}
concurrency:
group: cleanup-preview-${{ github.event.number }}
cancel-in-progress: false
jobs:
cleanup:
if: github.repository == 'PaloAltoNetworks/pan.dev'
name: Delete preview channel
runs-on: ubuntu-latest
environment: preview
permissions:
id-token: write
steps:
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
export_environment_variables: false
- name: Mask sensitive values in logs
run: |
echo "::add-mask::${{ steps.auth.outputs.credentials_file_path }}"
echo "::add-mask::${{ secrets.GCP_PROJECT_NUMBER }}"
- name: Delete Firebase preview channel
run: |
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://firebasehosting.googleapis.com/v1beta1/sites/${FIREBASE_SITE}/channels/pr${PR_NUMBER}")
case "$HTTP_CODE" in
200) echo "Deleted preview channel pr${PR_NUMBER}" ;;
404) echo "Channel pr${PR_NUMBER} not found or already deleted" ;;
*) echo "::error::Failed to delete channel pr${PR_NUMBER} (HTTP ${HTTP_CODE})"; exit 1 ;;
esac
env:
PR_NUMBER: ${{ github.event.number }}
FIREBASE_SITE: ${{ secrets.FIREBASE_SITE }}
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: ${{ steps.auth.outputs.credentials_file_path }}