diff --git a/.github/workflows/template_changeset_check.yml b/.github/workflows/template_changeset_check.yml
new file mode 100644
index 0000000..4bc2745
--- /dev/null
+++ b/.github/workflows/template_changeset_check.yml
@@ -0,0 +1,53 @@
+name: Changeset Check
+
+on: workflow_call
+
+jobs:
+ changeset-check:
+ name: changeset-check
+ if: (!contains(github.event.pull_request.user.login , '[bot]'))
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4.2.2
+
+ - name: Check for changesets
+ id: changeset-files
+ uses: tj-actions/changed-files@v45.0.6
+ with:
+ files: .changeset/*.md
+ base_sha: ${{ github.event.pull_request.base.sha }}
+
+ - name: Find existing comment
+ uses: peter-evans/find-comment@v3.1.0
+ id: find_comment
+ with:
+ issue-number: ${{ github.event.pull_request.number }}
+ comment-author: "github-actions[bot]"
+ body-includes:
+
+ - name: Update comment for found changeset
+ uses: peter-evans/create-or-update-comment@v4.0.0
+ if: steps.changeset-files.outputs.any_changed == 'true'
+ with:
+ comment-id: ${{ steps.find_comment.outputs.comment-id }}
+ issue-number: ${{ github.event.pull_request.number }}
+ body: |
+
+ ## 🦋 Changeset file found
+
+ Good job! A changeset file has been added in this PR. Your changes will be included in the next release.
+ edit-mode: replace
+
+ - name: Update comment for missing changeset
+ uses: peter-evans/create-or-update-comment@v4.0.0
+ if: steps.changeset-files.outputs.any_changed != 'true'
+ with:
+ comment-id: ${{ steps.find_comment.outputs.comment-id }}
+ issue-number: ${{ github.event.pull_request.number }}
+ body: |
+
+ ## ⚠️ Changeset file missing
+
+ No changeset file has been added in this PR. Please consider adding one if this PR contains user-facing changes.
+ edit-mode: replace
diff --git a/.github/workflows/template_changeset_release.yml b/.github/workflows/template_changeset_release.yml
new file mode 100644
index 0000000..aff7809
--- /dev/null
+++ b/.github/workflows/template_changeset_release.yml
@@ -0,0 +1,77 @@
+name: Changeset Release
+
+on:
+ workflow_call:
+ inputs:
+ node-version-file:
+ default: '.nvmrc'
+ required: false
+ type: string
+ publish-script:
+ default: 'pnpm release'
+ required: false
+ type: string
+ version-script:
+ default: 'pnpm changeset version'
+ required: false
+ type: string
+ node-registry:
+ required: false
+ type: string
+ node-registry-scope:
+ required: false
+ type: string
+ secrets:
+ app_id:
+ required: true
+ private_key:
+ required: true
+ npm-token:
+ required: true
+
+jobs:
+ release:
+ name: changeset-release
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Get App Token
+ uses: actions/create-github-app-token@v1.11.0
+ id: get_token
+ with:
+ app-id: ${{ secrets.app_id }}
+ private-key: ${{ secrets.private_key }}
+
+ - name: Checkout
+ uses: actions/checkout@v4.2.2
+ with:
+ token: ${{ steps.get_token.outputs.token }}
+
+ - name: Setup PNPM
+ uses: pnpm/action-setup@v4.0.0
+
+ - name: Setup Node
+ uses: actions/setup-node@v4.1.0
+ with:
+ node-version-file: ${{ inputs.node-version-file }}
+ cache: 'pnpm'
+ registry-url: ${{ inputs.node-registry }}
+ scope: ${{ inputs.node-registry-scope }}
+
+ - name: Install Dependencies
+ run: pnpm install --frozen-lockfile --ignore-scripts
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.npm-token }}
+
+ - name: Create Release Pull Request
+ id: changesets
+ uses: changesets/action@v1.4.9
+ with:
+ commit: 'chore(release): Bump package version'
+ title: '📦 Release New Version'
+ createGithubReleases: true
+ version: ${{ inputs.version-script }}
+ publish: ${{ inputs.publish-script }}
+ env:
+ GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
+ HOME: ${{ github.workspace }}
+ NODE_AUTH_TOKEN: ${{ secrets.npm-token }}
diff --git a/README.md b/README.md
index dfce92a..d9dc4c2 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,64 @@ jobs:
+### Changeset Check
+
+
+The action can be used to check a PR for the existance of changeset files. It will then add/update a comment on the PR.
+
+```yml
+name: Changeset Check
+on:
+ pull_request:
+ types: [opened, reopened, synchronize]
+
+jobs:
+ changeset-check:
+ uses: Staffbase/gha-workflows/.github/workflows/template_changeset_check.yml@v7.0.0
+```
+
+
+
+### Changeset Release
+
+
+The action can be used to create release PR and publish releases for repos using PNPM and changesets.
+
+⚠️ Make sure you have `@changesets/cli` installed as a dev-dependency in your project!
+
+```yml
+name: Release Changesets
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ changeset-release:
+ uses: Staffbase/gha-workflows/.github/workflows/template_changeset_release.yml@v7.0.0
+ with:
+ # optional: The file containing the Node.js version to use, defaults to .nvmrc
+ node-version-file: '.node-version'
+ # optional: The script to run on publish. Defaults to `pnpm release`
+ publish-script: 'pnpm publish'
+ # optional: The script to run for bumping the package versions. Defaults to `pnpm changeset version`
+ version-script: 'pnpm version'
+ # optional: The registry to use for Node.js packages.
+ node-registry: 'https://npm.pkg.github.com/'
+ # optional: The scope to use for Node.js packages.
+ node-registry-scope: '@staffbase'
+ secrets:
+ # identifier of the GitHub App for authentication
+ app-id: ${{ }}
+ # private key of the GitHub App
+ private-key: ${{ }}
+ # needs write:packages rights
+ npm-token ${{ }}
+```
+
+
+
### GitOps