ふり返る暇なんて無いね

日々のメモ書きをつらつらと。メインブログに書くほどでもないことを流してます

google-github-actions/deploy-cloudrunでlabelを付け替えるのをやめさせたい

v0からv2にバージョンアップした際にdeploy-cloudrunでlabelを更新する挙動に変わったので、これをやめさせたいといのが趣旨です。 Cloud Run Serviceのlabelはterraform側で制御したいので、GitHub Actions側で変更されると困るのです。

結論から言うと、 skip_default_labelsを trueにしてあげると良いです。

# (省略)
      - name: Deploy to Cloud Run
        uses: 'google-github-actions/deploy-cloudrun@v2'
        with:
          service: ${{ inputs.SERVICE_NAME }}
          image: ${{ inputs.REPOSITORY }}:${{ github.sha }}
          project_id: ${{ inputs.PROJECT_ID }}
          region: ${{ inputs.REGION }}
          skip_default_labels: true  # <<<<<  これ

ドキュメントの該当箇所は以下の通りです。

skip_default_labels: (Optional) Skip applying the special annotation labels that indicate the deployment came from GitHub Actions. The GitHub Action will automatically apply the following labels which Cloud Run uses to enhance the user experience:

managed-by: github-actions
commit-sha: <sha>

Setting this to true will skip adding these special labels. The default value is false.