Spotted in this Cloud Run example:
name: Build and Deploy to Cloud Run
on:
push:
branches:
- master
Useful if you don't want people opening pull requests against your repo that inadvertantly trigger a deploy action!
An alternative mechanism I've used is to gate the specific deploy steps in the action, like this.
# Only run the deploy if push was to master
- name: Set up Cloud Run
if: github.ref == 'refs/heads/master'
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '275.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Deploy to Cloud Run
if: github.ref == 'refs/heads/master'
run: |-
gcloud config set run/region us-central1
Created 2020-07-12T15:39:59+08:00 · Edit