diff --git a/action.yml b/action.yml index 102cabe..5b15c33 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,9 @@ inputs: github-token: description: 'Github token' required: true + github-username: + description: 'The Github username that is linked to the github token' + required: true tag-prefix: description: 'Prefix that is used for the git tag' default: 'v' diff --git a/index.js b/index.js index 0d08898..86bef73 100644 --- a/index.js +++ b/index.js @@ -23,11 +23,17 @@ const workspace = process.env.GITHUB_WORKSPACE console.log(`Current workspace: ${workspace}`) // Github Token -// const githubToken = process.env.GITHUB_TOKEN -// if (githubToken == null || githubToken == "") { -// core.setFailed('GITHUB_TOKEN not found.') -// return -// } +const githubToken = core.getInput('github-token') +if (githubToken == null || githubToken == "") { + core.setFailed('github-token not found as input.') + return +} +// Github Username +const githubUsername = core.getInput('github-username') +if (githubUsername == null || githubUsername == "") { + core.setFailed('github-username not found as input.') + return +} // ===================================================================== // ================================ RUN ================================ @@ -80,10 +86,8 @@ async function run() { await runInWorkspace('git', ['tag', tag]) // Pushing changes - // const remoteGitRepoUrl = `https://${githubToken}:x-oauth-basic@github.com/${process.env.GITHUB_REPOSITORY}.git` - // await runInWorkspace('git', ['push', remoteGitRepoUrl]) + const remoteGitRepoUrl = `https://${githubUsername}:${githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git` await runInWorkspace('git', ['push']) - // await runInWorkspace('git', ['push', remoteGitRepoUrl, '--tags']) await runInWorkspace('git', ['push', '--tags']) } catch (error) {