ChangesetsSnapshot
ActionsThis action for Changesets runs the Snapshot workflow for your repository, based on changes done in Pull Requests.
This action is helpful if you wish to create an automated release flow for changes done in PRs, on in any temporary change.
The following flow is being executed:
- Check for available 
changesetfiles in the PR. - Runs 
versionflow with--snapshotprovided. - Runs user script for build/preparation for the release.
 - Runs 
publishflow with--tagand--no-git-tag(to create a "temporary" release) - Publishes a GitHub comment on the Pull Request, with the list of releases done.
 
This GitHub Action does not create GitHub Releases and does not push Git tags - it meant to be used for canary releases, and encapsulate the changes within a PR.
prepareScript- A custom, user-provided script, that is being executed betweenversionandpublishscripts. Usually, this is where yourbuildscript goes.tag- The gittagto be used with the--snapshot TAG(versioncommand) and--tag TAG(publishcommand)cwd- Changes node'sprocess.cwd()if the project is not located on the root. Default toprocess.cwd()setupGitUser- Sets up the git user for commits as"github-actions[bot]". Default totrue
- published - A boolean value to indicate whether a publishing is happened or not
 - publishedPackages - A JSON array to present the published packages. The format is 
[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}] 
Create a file at .github/workflows/snapshot.yml with the following content.
name: Snapshot
on:
  pull_request: # Run only for PRs
    branches:
      - master
    paths:
      - ".changeset/**/*.md" # this will make sure to run only on PRs that adds Changesets
jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    if: github.event.pull_request.head.repo.full_name == github.repository # run only for original, non-fork PRs
    steps:
      - name: Checkout Master
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Use Node
        uses: actions/setup-node@v3
        with:
          node-version: 18
      # this is where you do your regular setup, dependencies installation and so on
      - name: Release Snapshot
        uses: "the-guild-org/[email protected]"
        with:
          tag: alpha
          prepareScript: "yarn build"
        env:
          NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} # NPM Token
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub TokenChangesetsSnapshot is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.
