Replacing GITHUB_TOKEN with PAT
Since the permissions for `GITHUB_TOKEN` are [limited](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret) to the repository that contains the workflow, it won't be possible to use `GITHUB_TOKEN` to access other private repositories. Instead, until [centrally managed workflows](https://github.com/github/roadmap/issues/98) are implemented, users would need to create and us a PAT to access other private repositories from a workflow.
This commit is contained in:
@@ -725,7 +725,7 @@ jobs:
|
||||
|
||||
#### Example using action inside a different private repository than the workflow
|
||||
|
||||
Your workflow must checkout the private repository and reference the action locally.
|
||||
Your workflow must checkout the private repository and reference the action locally. You will need to generate a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) and add it to your [repository](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) or [organisation](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-an-organization).
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -737,7 +737,7 @@ jobs:
|
||||
with:
|
||||
repository: octocat/my-private-repo
|
||||
ref: v1.0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
path: ./.github/actions/my-private-repo
|
||||
- name: Run my action
|
||||
uses: ./.github/actions/my-private-repo/my-action
|
||||
|
||||
Reference in New Issue
Block a user