-
Apparently the $GITHUB_TOKEN only has permissions for the current repo (which makes sense) – is there a way to allow access to another private repo? It’s currently failing:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
You should be able to set a custom token when using the checkout action. So, if you have a token that you know will have access to both your current repo as well as the submodule(s), you can run a step like:
Which would use a secret called “ACCESS_TOKEN” (which you should then create in the repository that runs your workflow) to pull the repositories. |
Beta Was this translation helpful? Give feedback.
-
Cool yeah that makes sense. I only wish there were a way to generate a custom token with restricted access to only a couple of repos 😕 I guess I’ll probably make a bot account with limited permissions and go with that. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Sadly they broke that with actions@v2 so beware when updating! You now have to use something like this if you want to keep using SSH URLs instead of HTTPS:
|
Beta Was this translation helpful? Give feedback.
-
How to generete the token btw? |
Beta Was this translation helpful? Give feedback.
-
As per actions/checkout#287 (comment), it is now possible to use jobs:
test-submodules:
runs-on: ubuntu-latest
steps:
- name: Get token from Github App
uses: actions/create-github-app-token@v1
id: app_token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PEM }}
# owner is required, otherwise the creds will fail the checkout step
owner: ${{ github.repository_owner }}
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
submodules: true
token: ${{ steps.app_token.outputs.token }} It feels a bit over the top to create an entire GitHub App for this purpose, but it works and is more robust than a personal access token. |
Beta Was this translation helpful? Give feedback.
You should be able to set a custom token when using the checkout action. So, if you have a token that you know will have access to both your current repo as well as the submodule(s), you can run a step like:
Which would use a secret called “ACCESS_TOKEN” (which you should then create in the repository that runs your workflow) to pull the repositories.