actions / create-github-app-token

GitHub Action for creating a GitHub App Installation Access Token
https://github.com/marketplace/actions/create-github-app-token
MIT License
321 stars 46 forks source link

add compiled credentials to outputs #137

Closed iamstarkov closed 1 month ago

iamstarkov commented 1 month ago

This is the iteration of #105

I'd like to have compiled credentials as an output. I'm not sure about commiter, it's just how I'll be using it. Perhaps credentials is a better name?

My use case is that the following quite lengthy:

  - uses: org/gitops@v2
    with:
      github-token: ${{ steps.app-auth.outputs.token }}
      repo: gitops-repo
      commiter: "${{steps.app-auth.outputs.app-slug}}[bot] <${{ steps.app-auth.outputs.installation-id }}+${{ steps.app-auth.outputs.app-slug }}[bot]@users.noreply.github.com"

And I'd like to use something less verbose, like this:

  - uses: org/gitops@v2
    with:
      github-token: ${{ steps.app-auth.outputs.token }}
      repo: gcp-domain-name
      commiter: "${{ steps.app-auth.outputs.credentials }}"

Im going to use this credentials as a commiter value for the gitops commits, while keeping the author as pull-request authors

What do you think of this idea? Are you open to this addition? if you are open to the idea and credentials is acceptable name, I will update docs and test to finalise the pull-request

iamstarkov commented 1 month ago

shame really, I'm writing an gitops action for developers and it will be so much easier to use committer output field rather than asking them to construct it by themselves

gr2m commented 1 month ago

I'm writing an gitops action for developers and it will be so much easier to use committer output field rather than asking them to construct it by themselves

you will have to document usage of your action anyway, which will include the use of this action. Adding another step to create a new output for the committer really doesn't add much, your users will end up copy-and-pasting your usage example anyway.

Here is an example

      - uses: actions/create-github-app-token@main
        id: app-auth
        with:
          app-id: ${{ vars.GR2M_GITHUB_APP_ID }}
          private-key: ${{ secrets.GR2M_GITHUB_APP_PRIVATE_KEY }}
      - id: committer
        run: echo "string=${{steps.app-auth.outputs.app-slug}}[bot] <${{ steps.app-auth.outputs.installation-id }}+${{ steps.app-auth.outputs.app-slug }}[bot]@users.noreply.github.com>"  >> "$GITHUB_OUTPUT"
      - run: echo "committer string is ${{steps.committer.outputs.string}}"

I'll add that to our README

gr2m commented 1 month ago

there you go, let us know what you think: https://github.com/actions/create-github-app-token/pull/142

iamstarkov commented 1 month ago

@gr2m thank you, it looks good. I'll close this pr

create-app-token-action-releaser[bot] commented 1 month ago

:tada: This issue has been resolved in version 1.10.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: