Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eloymg
Copy link
Contributor

@eloymg eloymg commented Jul 16, 2025

Adding github actions to use vault Github app token broker

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@eloymg eloymg changed the title Adding create-github-app-token action feat(create-github-app-token): adding create-github-app-token action Jul 16, 2025
@eloymg eloymg force-pushed the create-github-app-token branch from ef3513d to 6fba5d5 Compare July 18, 2025 05:54
@eloymg eloymg marked this pull request as ready for review July 18, 2025 06:01
@eloymg eloymg requested a review from a team as a code owner July 18, 2025 06:01
Copy link
Contributor

@zerok zerok left a 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
Copy link
Contributor

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"
Copy link
Contributor

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
Copy link
Contributor

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? 🙂

Comment on lines 1 to 2
name: Create Github App Token
description: Composite action (step) to get create github app token using vault.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Get Github Token
- name: Get GitHub Token

@eloymg
Copy link
Contributor Author

eloymg commented Jul 18, 2025

@zerok Thank you for the review! :D I added some of the suggestions and other little improvements

@eloymg eloymg requested a review from zerok July 18, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants