Skip to content

Commit

Permalink
Composite Action to activate SA in GitHub Actions Runners (#24626)
Browse files Browse the repository at this point in the history
* Adding composite action for service account activation

* Adding composite action for service account activation

* Adding an always condition to the key removal step

Co-authored-by: Elias Segundo <elias.segundo@luisrazo.local>
  • Loading branch information
elink21 and Elias Segundo authored Dec 11, 2022
1 parent 359a641 commit f1fcf0a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/actions/activate-service-account/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Activate Service Account"
description: Setup a Service account with the key provided in base64 as an input
inputs:
GCP_SERVICE_ACCOUNT:
description: Service account to activate in base64 format
required: true

runs:
using: composite
steps:
- name: Setup GCP account
env:
SA_KEY_CONTENT: ${{inputs.GCP_SERVICE_ACCOUNT}}
shell: bash
run: |
echo "$SA_KEY_CONTENT" | base64 -d > /tmp/gcp_access.json
gcloud auth activate-service-account --key-file="/tmp/gcp_access.json" --no-user-output-enabled
gcloud auth configure-docker -q --no-user-output-enabled >& /dev/null
- name: Removing Keyfile
if: ${{ always() }}
shell: bash
run: rm -f /tmp/gcp_access.json

0 comments on commit f1fcf0a

Please sign in to comment.