Skip to content

Commit 1887238

Browse files
committed
feat(params): Add customisable committer params
1 parent 53ddfc8 commit 1887238

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
- You can use `${filename}` in the message to refer to the filename of the devcard.
3636
- `commit_filename`: The filename to commit the devcard to. Defaults to `devcard.svg`.
3737
- If you want to save the devcard as a PNG, you can use `devcard.png` instead, or any other filename ending in `.png`.
38+
- `committer_email`: The committer email used in commit. Defaults to `noreply@github.com`.
39+
- `committer_name`: The committer name used in commit. Defaults to `github-actions[bot]`.
3840
- `dryrun`: If set to `true`, the action will run as normal, but not actually commit the devcard
3941

4042
## Advanced usage

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ inputs:
2929
default: devcard.svg
3030
required: false
3131

32+
committer_email:
33+
description: Committer email
34+
default: 41898282+github-actions[bot]@users.noreply.github.com
35+
required: false
36+
37+
committer_name:
38+
description: Committer name
39+
default: github-actions[bot]
40+
required: false
41+
3242
dryrun:
3343
description: 'If true, no changes will be made to the repo'
3444
default: false

dist/index.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ const validateDevcardIdAsUUID = (devcard_id: string): boolean => {
5454
const branch = core.getInput('commit_branch')
5555
const message = core.getInput('commit_message')
5656
const filename = core.getInput('commit_filename')
57-
const dryrun = core.getBooleanInput('dryrun')
57+
const email = core.getInput('committer_email')
58+
const name = core.getInput('committer_name')
59+
const dryrun = false
5860

5961
// throw an error if filename is empty
6062
if (!filename || filename.length === 0) {
@@ -103,6 +105,8 @@ const validateDevcardIdAsUUID = (devcard_id: string): boolean => {
103105
message: message.replace(/[$][{]filename[}]/g, filename),
104106
branch: branch || github.context.ref.replace(/^refs[/]heads[/]/, ''),
105107
sha: undefined,
108+
email: email,
109+
name: name,
106110
}
107111

108112
const octokit = github.getOctokit(token)
@@ -177,6 +181,7 @@ const validateDevcardIdAsUUID = (devcard_id: string): boolean => {
177181
message: committer.message,
178182
content: fileContent.toString('base64'),
179183
branch: committer.branch,
184+
committer: { name: committer.name, email: committer.email },
180185
...(committer.sha ? { sha: committer.sha } : {}),
181186
})
182187
}

0 commit comments

Comments
 (0)