-
Notifications
You must be signed in to change notification settings - Fork 26
feat(create-github-app-token): adding create-github-app-token action #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ef3513d
to
6fba5d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome, thank you! Just some consistency suggestions.
VAULT_URL="https://vault-github-actions.grafana-${VAULT_INSTANCE}.net" | ||
curl --fail -H "X-Vault-Token: ${{ steps.auth-vault.outputs.vault_token }}" \ | ||
-H "Proxy-Authorization-Token: Bearer ${{ steps.get-github-jwt-token.outputs.github-jwt }}" \ | ||
"{$VAULT_URL}/v1/github-app-${GITHUB_APP}/token/${REPOSITORY_NAME}-${{ steps.normalize-workflow-name.outputs.ref_sha }}-${PERMISSION_SET}" | jq -r '.data.token' > github_token.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The github_token.txt
file can be deleted after this step, right?
REPOSITORY_NAME: ${{ github.event.repository.name }} | ||
PERMISSION_SET: ${{ inputs.permission_set}} | ||
run: | | ||
VAULT_URL="https://vault-github-actions.grafana-${VAULT_INSTANCE}.net" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're using this URL in multiple places, please move that into an environment variable for the whole job or use a step to set it 🙂
- id: get-github-token | ||
uses: grafana/shared-workflows/actions/create-github-app-token@create-github-app-token/v0.1.0 | ||
with: | ||
github_app: github-app-name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add also a set of permissions here to that the format is clear to users? 🙂
name: Create Github App Token | ||
description: Composite action (step) to get create github app token using vault. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: Create Github App Token | |
description: Composite action (step) to get create github app token using vault. | |
name: Create GitHub App Token | |
description: Composite action (step) to get create GitHub app token using Vault. |
| jq -r '.auth.client_token' > vault_token.txt | ||
echo "vault_token=$(cat vault_token.txt)" >> $GITHUB_OUTPUT | ||
|
||
- name: Get Github Token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- name: Get Github Token | |
- name: Get GitHub Token |
Co-Authored-By: Horst <[email protected]>
@zerok Thank you for the review! :D I added some of the suggestions and other little improvements |
Adding github actions to use vault Github app token broker