From ebcf660667c0bbbe9375f72a408c75ab81b5b127 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 30 Sep 2024 20:40:57 +0800 Subject: [PATCH] Try again --- dist/index.js | 10 +++++----- index.js | 10 +++++----- test-fixtures/file.js | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/index.js b/dist/index.js index bfe07f5..7d7c3be 100644 --- a/dist/index.js +++ b/dist/index.js @@ -27394,13 +27394,16 @@ git checkout ${process.env.GITHUB_REF_NAME}`) } } else { core.debug(`Initializing git repository at "${sourcePath}"`) + // Custom git init requires own authorization setup (inspired from actions/checkout) + const repoUrl = new URL(REPO_URL) + repoUrl.username = 'x-access-token' + repoUrl.password = ghToken if (dryRun) { core.info(`\ [dry run] git init -b ${targetBranch} git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com -git config http.${process.env.GITHUB_SERVER_URL}/.extraheader AUTHORIZATION: basic *** git add . git commit -m "Sync" git remote add origin ${REPO_URL} @@ -27410,12 +27413,9 @@ git push -f origin HEAD:${targetBranch}`) await index_x('git', ['config', 'user.name', 'github-actions[bot]']) // prettier-ignore await index_x('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com']) - // Custom git init requires own authorization setup (inspired from actions/checkout) - // prettier-ignore - await index_x('git', ['config', `http.${process.env.GITHUB_SERVER_URL}/.extraheader`, `AUTHORIZATION: basic ${ghToken}`]) await index_x('git', ['add', '.']) await index_x('git', ['commit', '-m', 'Sync']) - await index_x('git', ['remote', 'add', 'origin', REPO_URL]) + await index_x('git', ['remote', 'add', 'origin', repoUrl]) core.debug(`Force pushing to "${targetBranch}" branch`) await index_x('git', ['push', '-f', 'origin', `HEAD:${targetBranch}`]) await promises_namespaceObject.rm(gitDir, { recursive: true, force: true }) diff --git a/index.js b/index.js index 6edbb17..9193a1f 100644 --- a/index.js +++ b/index.js @@ -121,13 +121,16 @@ git checkout ${process.env.GITHUB_REF_NAME}`) } } else { core.debug(`Initializing git repository at "${sourcePath}"`) + // Custom git init requires own authorization setup (inspired from actions/checkout) + const repoUrl = new URL(REPO_URL) + repoUrl.username = 'x-access-token' + repoUrl.password = ghToken if (dryRun) { core.info(`\ [dry run] git init -b ${targetBranch} git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com -git config http.${process.env.GITHUB_SERVER_URL}/.extraheader AUTHORIZATION: basic *** git add . git commit -m "Sync" git remote add origin ${REPO_URL} @@ -137,12 +140,9 @@ git push -f origin HEAD:${targetBranch}`) await x('git', ['config', 'user.name', 'github-actions[bot]']) // prettier-ignore await x('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com']) - // Custom git init requires own authorization setup (inspired from actions/checkout) - // prettier-ignore - await x('git', ['config', `http.${process.env.GITHUB_SERVER_URL}/.extraheader`, `AUTHORIZATION: basic ${ghToken}`]) await x('git', ['add', '.']) await x('git', ['commit', '-m', 'Sync']) - await x('git', ['remote', 'add', 'origin', REPO_URL]) + await x('git', ['remote', 'add', 'origin', repoUrl]) core.debug(`Force pushing to "${targetBranch}" branch`) await x('git', ['push', '-f', 'origin', `HEAD:${targetBranch}`]) await fs.rm(gitDir, { recursive: true, force: true }) diff --git a/test-fixtures/file.js b/test-fixtures/file.js index 368114b..cf05434 100644 --- a/test-fixtures/file.js +++ b/test-fixtures/file.js @@ -1 +1 @@ -console.log('file') +console.log('test-fixture-file')