Skip to content

Commit

Permalink
Update GitHub auth method (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat authored Oct 23, 2023
1 parent 717265e commit 10973f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
cat <<EOS | jq > expected.json
{
"author": {
"login": "github-actions"
"is_bot": true,
"login": "app/github-actions"
},
"body": "",
"files": [
Expand Down
9 changes: 5 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ esac
git config --global user.name ${INPUT_GIT_USER}
git config --global user.email ${INPUT_GIT_EMAIL}

# Set GITHUB_USER to workaround hub command auth error
# https://github.com/github/hub/issues/2149#issuecomment-513214342
export GITHUB_USER="${GITHUB_ACTOR}"
export GITHUB_TOKEN=${INPUT_GITHUB_TOKEN}
git config --global \
url."https://x-access-token:${INPUT_GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"

for repo in ${INPUT_REPOS}
do
echo "Syncing ${repo}"
tmpdir=$(mktemp -d)
git clone --depth=1 https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${repo} ${tmpdir}
git clone --depth=1 https://github.com/${repo} ${tmpdir}
base_branch=$(git -C ${tmpdir} symbolic-ref --short HEAD)
git -C ${tmpdir} checkout -b ${head_branch}

Expand Down Expand Up @@ -102,6 +101,7 @@ do
message=${message_template//%v/${version}}
git -C ${tmpdir} commit -m "${message}"

echo "Pushing branch"
if ! ${push_prefix} git -C ${tmpdir} push ${force_push} origin ${head_branch}
then
# Allow to fetch existing PR branch
Expand All @@ -120,6 +120,7 @@ do
echo "- Reusing existing branch"
fi

echo "Opening PR"
if [ $(cd ${tmpdir}; gh pr list --head ${head_branch} | wc -l) -gt 0 ]
then
echo "- PR is already open"
Expand Down

0 comments on commit 10973f1

Please sign in to comment.