update github action script #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '[RELEASE] Version Packages' | |
on: | |
push: | |
branches: | |
- 'release-*' | |
workflow_dispatch: | |
jobs: | |
release: | |
permissions: | |
contents: write # to create release (changesets/action) | |
pull-requests: write # to create pull request (changesets/action) | |
name: Release Version Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} # checkout PR branch | |
- name: Use Node.js 18.16.1 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.16.1' | |
- name: Initialize npmrc | |
run: | | |
echo "" > $(npm config get userconfig) | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies with pnpm | |
run: pnpm install --no-frozen-lockfile | |
- name: Get branch name | |
id: get_branch | |
run: echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})" | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: pnpm changeset version | |
commit: 'chore: update versions - ${{ steps.get_branch.outputs.branch }}' | |
title: 'chore: update versions - ${{ steps.get_branch.outputs.branch }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update-pr-comment: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 18.16.1 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.16.1' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies with pnpm | |
run: pnpm install --no-frozen-lockfile | |
- name: Get current branch name | |
id: get_branch | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
- name: Check Changesets status | |
id: changesets | |
run: | | |
changes=$(pnpm changeset status --since origin/${{ steps.get_branch.outputs.branch }} --output=json) | |
echo "changes=$changes" >> $GITHUB_OUTPUT | |
- name: Update PR comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: changesets-status | |
message: | | |
## Changesets Status (based on ${{ steps.get_branch.outputs.branch }} branch) | |
```json | |
${{ steps.changesets.outputs.changes }} | |
``` | |
This comment is automatically updated. |