Skip to content

How can a Github workflow read a file on another private repository hosted on the same GitHub account? #27201

Discussion options

You must be logged in to vote

You can use a Personal Access Token (PAT) with the repo scope to authorize the request to the raw.githubusercontent.com URL for the file. If you add the PAT as a secret for your repository, you can do something like this:

- name: get file
  env:
    TOKEN: ${{ secrets.repo_token }}
  run: |
    curl -H "Authorization: token ${TOKEN}" https://raw.githubusercontent.com/acct/repo2/main/test.json

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants