A GitHub Action for creating Changesets files for dependencies updates.
This action will automatically monitor all your PRs, and find changes in package.json
files. Then it creates/updates a changeset
file, and commits it to your PR.
Works great with Renovate and dependabot!
This Action only create Changeset files for the following:
- Packages that are under the monorepo/Workspace and not being ignored.
- Packages that are not marked as
private: true
. - Packages that are located in
dependencies
orpeerDependencies
. - Packages that are not ignored by
changesets
config.
- Automatic Changesets based on changes in
package.json
- Smart
semver
inference and links to NPM - Integration with Prettier (for the created YAML file)
- Flexible CI execution (depends on token, see below)
Create a GitHub Actions workflow with the following:
name: dependencies
on: pull_request
jobs:
changeset:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create/Update Changesets
uses: "the-guild-org/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Note: using secrets.GITHUB_TOKEN
will not trigger CI again.
If you wish that the created commit will also trigger CI, you must create a custom PAT from any regular GitHub user (instructions here).
Then, add it to your repository Secrets
with a custom name (MY_GH_TOKEN
in this example. Then, configure the checkout
action as below and use the custom token for this action:
name: dependencies
on: pull_request
jobs:
changeset:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.MY_GH_TOKEN }} # use it here
- name: Create/Update Changesets
uses: "the-guild-org/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.MY_GH_TOKEN }} # and also here
The created commit will still appear as
github-actions-bot
, but this time it will run CI ;)
You may also set preCommit
configuration with a custom script, if you wish to run a script before committing the actual files. This is useful if you want to run custom liting/prettier workflows.