Auto-pass required checks for changeset release PRs (#43) #48
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| registry-url: 'https://registry.npmjs.org' | |
| scope: '@ciolabs' | |
| - name: Install npm 11.5.1+ for OIDC support | |
| run: npm install -g npm@latest | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm run build | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm run changeset:publish | |
| version: pnpm run changeset:version | |
| commit: 'chore: release packages' | |
| title: 'chore: release packages' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Auto-pass required checks for release PR | |
| if: steps.changesets.outputs.pullRequestNumber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR_NUMBER="${{ steps.changesets.outputs.pullRequestNumber }}" | |
| HEAD_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.head.sha') | |
| gh api repos/${{ github.repository }}/statuses/$HEAD_SHA \ | |
| --method POST \ | |
| -f state=success \ | |
| -f context=Test \ | |
| -f description="Auto-passed for changeset release branch" |