Skip to content

Commit

Permalink
fix: test with username
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Nov 30, 2023
1 parent 4ba74a2 commit 2294e52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
20 changes: 12 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ================================
Expand Down Expand Up @@ -80,10 +86,8 @@ async function run() {
await runInWorkspace('git', ['tag', tag])

// Pushing changes
// const remoteGitRepoUrl = `https://${githubToken}:[email protected]/${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) {
Expand Down

0 comments on commit 2294e52

Please sign in to comment.