2.0.0 • Published 2 years ago

octoherd-script-bump-node-version-in-workflows v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

octoherd-script-bump-node-version-in-workflows

Octoherd script to set the node-version input for actions/setup-node to the latest LTS major version

@latest Build Status

Usage

Note: You must set a custom token for this script because it requires the workflow scope. Create a token here

Minimal usage

npx octoherd-script-bump-node-version-in-workflows -T ghp_0123456789abcdefghjklmnopqrstuvwxyzA

Pass all options as CLI flags to avoid user prompts

npx octoherd-script-bump-node-version-in-workflows \
  -T ghp_0123456789abcdefghjklmnopqrstuvwxyzA \
  -R "gr2m/*" \
  --node-version 16 \
  --workflow release.yml

The script uses js-yaml, so the updated YAML code might also include formatting changes. Unfortunately the parsing and then serializing using js-yaml removes all comments. But the script will only update a file if a node-version was actually changed.

If node-version is set to a value which includes a ${{ ... }} placeholder then it's not updated.

I run the script against all @octokit repositories so I'm fairly confident it doesn't break anything.

Options

optiontypedescription
--node-versionnumberRequired May be set to lts/*. See all supported versions
--workflowstringworkflow file name or pattern to only update a subset of workflows. matcher is used for matching. Defaults to *
--octoherd-token, -TstringA personal access token (create). Script will create one if option is not set
--octoherd-repos, -Rarray of stringsOne or multiple space-separated repositories in the form of repo-owner/repo-name. repo-owner/* will find all repositories for one owner. * will find all repositories the user has access to. Will prompt for repositories if not set
--octoherd-bypass-confirmsbooleanBypass prompts to confirm mutating requests

Contributing

See CONTRIBUTING.md

About Octoherd

@octoherd is project to help you keep your GitHub repositories in line.

License

ISC