I am using the copy_file_to_another_repo_action
GitHub workflow from dmnemec
(
The token has the following permissions:
I've tried both a fine-grained token and classic token with appropriate permissions, with the same result. Those are the permissions for the fined-grained token (only for the destination repo, where the file needs to be uploaded):
Because the workflow uses the API_TOKEN_GITHUB with env:
instead of with:
, I tried using an environment secret instead, with the same result:
Is there something obvious I am missing?
This is the same question as: Github action to push build folder to a different repo. However, it has no accepted answer (and the current answer also hasn't worked for me). There is also How to commit and push to a private repo(A), from a different repo(B), in github actions workflow (B) , using personal access token but I am following the same steps and still facing this issue.
Edit:
I tested my token as per the troubleshooting steps listed here (https://cpina.github.io/push-to-another-repository-docs/troubleshooting.html) and the token works as expected: I was able to create a branch and push to it.
Note that I forgot to mention that I've changed the destination branch to master from the original workflow (destination_branch: 'master'
) since the default was main.
CodePudding user response:
The issue in my case was that I had created the secret in the destination repo instead of the source repo. Swapping those two fixed the issue.