diff --git a/action.yaml b/action.yaml index 9fe3b93..2db17cd 100644 --- a/action.yaml +++ b/action.yaml @@ -1,5 +1,18 @@ name: 'Auto bump version' description: 'Bumps target branch version on PR merge' +inputs: + name: + description: 'Name to set git push author' + required: false + default: 'GitHub Actions Bot' + email: + description: 'Email to set git push author' + required: false + default: 'action@github.com' + token: + description: 'Write token to the repository' + required: false + default: '' outputs: tag: description: 'New tag' diff --git a/index.js b/index.js index f06c097..39eda34 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,15 @@ const core = require('@actions/core'); const github = require('@actions/github'); -const { exec } = require('child_process'); +const { exec, execSync } = require('child_process'); try { - exec(`git config user.name "GitHub Actions Bot" && git config user.email "action@github.com"`, (err) => { + const inputs = { + name: core.getInput('name'), + email: core.getInput('email'), + token: core.getInput('token') || process.env.TOKEN, + }; + + exec(`git config user.name "${inputs.name}" && git config user.email "${inputs.email}"`, (err) => { if (err) { throw err; }