Skip to content

Commit

Permalink
feat: allow to use custom actor
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideIadeluca committed Oct 18, 2024
1 parent 73c39c9 commit 8f06c53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ inputs:
description: Set to `true` to commit all file changes, not just files in the dist JS directory.
default: 'false'
required: false
git_actor_name:
description: The name of the git actor to use for the bundled JS output.
required: false
git_actor_email:
description: The email of the git actor to use for the bundled JS output.
required: false
11 changes: 6 additions & 5 deletions src/jobs/commitChangesToGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ export default async function commitChangesToGit(jp: FSJetpack): Promise<void> {
maxConcurrentProcesses: 1,
};

const gitActorName = core.getInput('git_actor_name', { required: false, trimWhitespace: true }) || 'flarum-bot';
const gitActorEmail = core.getInput('git_actor_email', { required: false, trimWhitespace: true }) || '[email protected]';

const config = {
author: {
name: 'flarum-bot',
email: '[email protected]',
name: gitActorName,
email: gitActorEmail,
},
};

Expand Down Expand Up @@ -61,11 +64,9 @@ Includes transpiled JS/TS${core.getInput('build_typings_script') !== '' ? ', and
[skip ci]`);

const token = core.getInput('github_token', { required: true, trimWhitespace: true });

debugLog(`** Pushing commit`);

await git.addRemote('upstream', `https://${process.env.GITHUB_ACTOR}:${token}@github.com/${process.env.GITHUB_REPOSITORY}.git`);
await git.addRemote('upstream', `https://github-actions:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`);

log(`${status}`);

Expand Down

0 comments on commit 8f06c53

Please sign in to comment.