forked from benchmark-action/github-action-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configurable Git commit, user and email
- Add support for configuring the Git commit message, user name and user email. - Run `npm audit fix` to resolve vulnerability. - Fix prettier complaining about line-endings on Windows. - Skip test that is not supported on Windows. Relates to benchmark-action#234.
- Loading branch information
1 parent
fe4e90e
commit 785538a
Showing
10 changed files
with
126 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,6 +532,26 @@ which means there is no limit. | |
|
||
If set to `true`, the workflow will skip fetching branch defined with the `gh-pages-branch` variable. | ||
|
||
#### `commit-message` (Optional) | ||
|
||
- Type: String | ||
- Default: `add ${name} (${tool}) benchmark result for ${commit}` | ||
|
||
Overrides the message to use when committing the benchmark results to Git. | ||
|
||
#### `commit-user-name` (Optional) | ||
|
||
- Type: String | ||
- Default: `github-action-benchmark` | ||
|
||
Specifies the value to use for `user.name` when committing the benchmark results to Git. | ||
|
||
#### `commit-user-email` (Optional) | ||
|
||
- Type: String | ||
- Default: `[email protected]` | ||
|
||
Specifies the value to use for `user.email` when committing the benchmark results to Git. | ||
|
||
### Action outputs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ interface ExecResult { | |
code: number | null; | ||
} | ||
|
||
interface GitConfig { | ||
commitUserName?: string; | ||
commitUserEmail?: string; | ||
} | ||
|
||
async function capture(cmd: string, args: string[]): Promise<ExecResult> { | ||
const res: ExecResult = { | ||
stdout: '', | ||
|
@@ -54,15 +59,15 @@ export function getServerName(repositoryUrl: string | undefined): string { | |
return getServerUrlObj(repositoryUrl).hostname; | ||
} | ||
|
||
export async function cmd(additionalGitOptions: string[], ...args: string[]): Promise<string> { | ||
export async function cmd(config: GitConfig, additionalGitOptions: string[], ...args: string[]): Promise<string> { | ||
core.debug(`Executing Git: ${args.join(' ')}`); | ||
const serverUrl = getServerUrl(github.context.payload.repository?.html_url); | ||
const userArgs = [ | ||
...additionalGitOptions, | ||
'-c', | ||
'user.name=github-action-benchmark', | ||
`user.name=${config.commitUserName ?? 'github-action-benchmark'}`, | ||
'-c', | ||
'[email protected]', | ||
`user.email=${config.commitUserEmail ?? '[email protected]'}`, | ||
'-c', | ||
`http.${serverUrl}/.extraheader=`, // This config is necessary to support actions/checkout@v2 (#9) | ||
]; | ||
|
@@ -84,6 +89,7 @@ function getRepoRemoteUrl(token: string, repoUrl: string): string { | |
} | ||
|
||
export async function push( | ||
config: GitConfig, | ||
token: string, | ||
repoUrl: string | undefined, | ||
branch: string, | ||
|
@@ -98,10 +104,11 @@ export async function push( | |
args = args.concat(options); | ||
} | ||
|
||
return cmd(additionalGitOptions, ...args); | ||
return cmd(config, additionalGitOptions, ...args); | ||
} | ||
|
||
export async function pull( | ||
config: GitConfig, | ||
token: string | undefined, | ||
branch: string, | ||
additionalGitOptions: string[] = [], | ||
|
@@ -115,10 +122,11 @@ export async function pull( | |
args = args.concat(options); | ||
} | ||
|
||
return cmd(additionalGitOptions, ...args); | ||
return cmd(config, additionalGitOptions, ...args); | ||
} | ||
|
||
export async function fetch( | ||
config: GitConfig, | ||
token: string | undefined, | ||
branch: string, | ||
additionalGitOptions: string[] = [], | ||
|
@@ -132,10 +140,11 @@ export async function fetch( | |
args = args.concat(options); | ||
} | ||
|
||
return cmd(additionalGitOptions, ...args); | ||
return cmd(config, additionalGitOptions, ...args); | ||
} | ||
|
||
export async function clone( | ||
config: GitConfig, | ||
token: string, | ||
ghRepository: string, | ||
baseDirectory: string, | ||
|
@@ -150,9 +159,11 @@ export async function clone( | |
args = args.concat(options); | ||
} | ||
|
||
return cmd(additionalGitOptions, ...args); | ||
return cmd(config, additionalGitOptions, ...args); | ||
} | ||
|
||
export async function checkout( | ||
config: GitConfig, | ||
ghRef: string, | ||
additionalGitOptions: string[] = [], | ||
...options: string[] | ||
|
@@ -164,5 +175,5 @@ export async function checkout( | |
args = args.concat(options); | ||
} | ||
|
||
return cmd(additionalGitOptions, ...args); | ||
return cmd(config, additionalGitOptions, ...args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.