gha-publish-to-git
gha-publish-to-git copied to clipboard
could not use GITHUB_TOKEN
When i use GITHUB_TOKEN with github_token, i have:
- action.yml
- name: publish to develop
if: "contains(github.ref, 'develop')"
uses: seanmiddleditch/gha-publish-to-git@master
with:
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
source_folder: doc/public
target_folder: ${{ env.CURRENT_BRANCH }}
commit_author: ${{ env.BOT_ACTOR }}
commit_message: "chore(ci): deploy to gh-pages in folder ${{ env.CURRENT_BRANCH }}"
Result:
Run seanmiddleditch/gha-publish-to-git@master
with:
branch: gh-pages
github_token: ***
source_folder: doc/public
target_folder: develop
commit_author: Bot
commit_message: chore(ci): deploy to gh-pages in folder develop
host: github.com
env:
KUBEES_ACTOR: Bot
CURRENT_BRANCH: develop
/usr/bin/docker run --name ee672d0d4dc813e4029b708572868c5811f_18630a --label 671ee6 --workdir /github/workspace --rm -e KUBEES_ACTOR -e CURRENT_BRANCH -e INPUT_BRANCH -e INPUT_GITHUB_TOKEN -e INPUT_SOURCE_FOLDER -e INPUT_TARGET_FOLDER -e INPUT_COMMIT_AUTHOR -e INPUT_COMMIT_MESSAGE -e INPUT_REPOSITORY -e INPUT_HOST -e INPUT_GITHUB_PAT -e INPUT_DRY_RUN -e INPUT_WORKING_DIRECTORY -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/api/api":"/github/workspace" 671ee6:72d0d4dc813e4029b708572868c5811f "" "gh-pages" "github.com" "***" "" "doc/public" "develop" "Bot" "chore(ci): deploy to gh-pages in folder develop" "" ""
Publishing doc/public to https://***@github.com/bot/api.git:gh-pages/develop
Initializing repository with remote https://***@github.com/bot/api.git
Initialized empty Git repository in /github/home/gitrepo.AJCaDL/.git/
Fetching https://***@github.com/bot/api.git:gh-pages
fatal: could not read Password for 'https://***@github.com': No such device or address
##[error]Docker run failed with exit code 1
GITHUB_TOKEN is tied to the repository where the action runs. It cannot push on another repository since it does not have right for it.
You'll have to use a PAT instead.
This example deploy on the same repository.
I use it to deploy from my develop branch to my gh-pages branch.
There's a report in PR #3 that some repos require use of PAT even for the same repository, based on two-factor authentication settings. Can you verify that works?
I'm using an organization and a private repository without two-factor.
I try on another organization with and without two-factor and it's the same error.
After i try to disable the two-factor in my personnal account to see if and it fail too.
Maybe it could be necessary to use the PAT if we are inside an organization.
If i insert the PAT in the github_token input:
- github_token: ${{ secrets.GH_TOKEN }}
it works.
I just ran into the same issue, and the solution from @guiadco also worked for me. The following was the config for me that failed:
uses: seanmiddleditch/gha-publish-to-git@master
with:
branch: master
github_token: ${{ secrets.GITHUB_TOKEN }}