crabcode release by @MrFlounder #53
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-please | |
| run-name: crabcode release by @${{ github.actor }} | |
| concurrency: | |
| group: release-please-${{ github.ref }} | |
| cancel-in-progress: false | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| version: ${{ steps.release.outputs.version }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if PR exists | |
| id: check-pr | |
| run: | | |
| PR_OUTPUT='${{ steps.release.outputs.pr }}' | |
| if [ -n "$PR_OUTPUT" ] && [ "$PR_OUTPUT" != "null" ]; then | |
| echo "has_pr=true" >> $GITHUB_OUTPUT | |
| echo "pr_branch=$(echo '${{ steps.release.outputs.pr }}' | jq -r '.headBranchName')" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_pr=false" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: actions/checkout@v6 | |
| if: steps.check-pr.outputs.has_pr == 'true' | |
| with: | |
| ref: ${{ steps.check-pr.outputs.pr_branch }} | |
| fetch-depth: 1 | |
| - name: Format CHANGELOG.md with Prettier | |
| if: steps.check-pr.outputs.has_pr == 'true' | |
| run: | | |
| echo "Formatting CHANGELOG.md on branch: ${{ steps.check-pr.outputs.pr_branch }}" | |
| npx --yes prettier@latest --write CHANGELOG.md | |
| if git diff --quiet CHANGELOG.md; then | |
| echo "No formatting changes needed" | |
| else | |
| echo "Formatting changes detected, committing..." | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add CHANGELOG.md | |
| git commit -m "chore: format CHANGELOG.md with prettier" | |
| git push | |
| echo "Formatting committed and pushed" | |
| fi |