create-github-app-token icon indicating copy to clipboard operation
create-github-app-token copied to clipboard

Add `insteadOf` usage example

Open multimeric opened this issue 8 months ago • 1 comments

For workflows that don't explicitly take a token as an input, you need to configure git to use the generated token. For example, actions/checkout@v4 has a token argument so there is no issue, but your build simply does a pip install or uv sync, then there is no easy mechanism for telling it to use this token. However, this is surely a common pattern. So I propose we add something like this to the README:

      - name: Make git use the app token
        run: | 
            git config --global url."https://USERNAME:${GITHUB_TOKEN}@github.com/".insteadOf "[email protected]:"
            git config --global url."https://USERNAME:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
        env:
          GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

multimeric avatar Aug 05 '25 07:08 multimeric

I like it! Wanna send a pull request for further discussion? We should clarify the security implications of this, but it think it's a neat workaround for a common-enough problem, worth documenting

gr2m avatar Aug 11 '25 03:08 gr2m