Skip to content

Commit

Permalink
feat: added additional action parameter skip-ci (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtrion authored Aug 28, 2023
1 parent 0c6e383 commit 41e8259
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ inputs:
default: "false"
required: false

skip-ci:
description: If `true`, then the commit will not trigger CI pipelines.
default: "false"
required: false

runs:
using: node16
main: dist/index.js
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const allowed = [
const inputs = {
token: core.getInput('github-token', { required: true }),
config: core.getInput('config', { required: false }),
dry: core.getInput('dry-run', { required: false })
dry: core.getInput('dry-run', { required: false }),
skipCi: core.getInput('skip-ci', { required: false })
}

// error handler
Expand Down
7 changes: 6 additions & 1 deletion src/lib/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ export default async function (octokit, { changedRepositories, localFiles, input
core.debug(`${repo}: new tree: ${newTree.sha}`)
core.debug(inspect(newTree))

let commitMessage = `chore(template): sync with ${github.context.repo.owner}/${github.context.repo.repo}`
if (inputs.skipCi === 'true') {
commitMessage += ` [skip ci]`
}

// Make a new commit with the delta tree
try {
({ data: newCommit } = await octokit.request('POST /repos/{owner}/{repo}/git/commits', {
owner: github.context.repo.owner,
repo,
message: `chore(template): sync with ${github.context.repo.owner}/${github.context.repo.repo}`,
message: commitMessage,
tree: newTree.sha,
parents: [sha]
}))
Expand Down

0 comments on commit 41e8259

Please sign in to comment.