Interview Prep/Git & GitHub/Security: secrets, signing, access and supply chain

How do you give CI read access to a private submodule or private dependency repo?

IntermediateProductionSecurity: secrets, signing, access and supply chain
Answer

<details> <summary><b>Answer</b></summary>

Use a GitHub App installation token minted per run (actions/create-github-app-token) with read access to the specific repos, instead of a PAT. For checkout, pass the token and enable submodules.

- uses: actions/create-github-app-token@v1
  id: app
  with:
    app-id: ${{ vars.APP_ID }}
    private-key: ${{ secrets.APP_KEY }}
- uses: actions/checkout@v4
  with: { token: "${{ steps.app.outputs.token }}", submodules: recursive }
All Git & GitHub questions Roadmap: Git & GitHub

More on Security: secrets, signing, access and supply chain