Skip to content

feat(docs): update readme file #31

feat(docs): update readme file

feat(docs): update readme file #31

Workflow file for this run

name: Snapshot
on:
issue_comment:
types:
- created
jobs:
snapshot:
name: Snapshot Release
if: |
github.event.issue.pull_request &&
(startsWith(github.event.comment.body, '/snapit') || startsWith(github.event.comment.body, '/snapshot-release'))
runs-on: ubuntu-latest
steps:
- name: Enforce permission requirement
uses: prince-chrismc/check-actor-permissions-action@v1
with:
permission: write
- name: Add initial reaction
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ github.event.comment.id }}
reactions: eyes
- name: Checkout default branch
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
# issue_comment requires us to checkout the branch
# https://github.com/actions/checkout/issues/331#issuecomment-1120113003
- name: Checkout pull request branch
run: gh pr checkout ${{ github.event.issue.number }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# # Because changeset entries are consumed and removed on the
# # 'changeset-release/main' branch, we need to reset the files
# # so the following 'changeset version --snapshot' command will
# # regenerate the package version bumps with the snapshot releases
# - name: Reset changeset entries on changeset-release/main branch
# run: |
# if [[ $(git branch --show-current) == 'changeset-release/main' ]]; then
# git checkout origin/main -- .changeset
# fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
run: yarn
- name: Version snapshot release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: yarn version-packages-snapshot
- name: Publish release snapshot
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
run: yarn release-snapshot > /tmp/release-snapshot.out
- name: Add comment to pull request
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const fs = require("fs").promises;
const output = await fs.readFile("/tmp/release-snapshot.out", "utf8");
// Regular expression to match the published package lines
const regex = /@bahag-buttf\/[^\s@]+@[^\s]+/g;
// Find and extract package information
const packages = output.match(regex);
const body = (
`✨ **Thanks @${context.actor}! ` +
`Your snapshot(s) been published to npm.**\n\n` +
`Test the snapshot(s) by updating your \`package.json\` ` +
`with the newly published version(s):\n` +
packages.map(tag => (
'```sh\n' +
`yarn add ${tag}\n` +
'```'
)).join('\n')
)
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Add final reaction
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket