fix(autofix.ci): apply automated fixes #805
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: โจ Check Conventional Commit Title | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-title: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_success: ${{ steps.commitlint.outputs.is_success }} | |
| commitlint_log: ${{ steps.commitlint.outputs.commitlint_log }} | |
| steps: | |
| - name: ๐ฅ Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: ๐ฃ Install bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: canary | |
| - name: ๐ฆ Install commitlint | |
| run: bun add -d @commitlint/cli @commitlint/config-conventional | |
| - name: ๐ Create commitlint config | |
| run: | | |
| echo 'export default { extends: ["@commitlint/config-conventional"], | |
| ignores: [(message: string) => message.includes("Signed-off-by: dependabot[bot]")] }' > commitlint.config.ts | |
| - name: ๐ Validate PR title with commitlint | |
| id: commitlint | |
| env: | |
| TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| echo "$TITLE" | bun commitlint --verbose &> >(tee -p commitlint.log) || STATUS=$? | |
| if [ $STATUS -ne 0 ]; then | |
| echo "is_success=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_success=true" >> $GITHUB_OUTPUT | |
| fi | |
| UUID=$(uuidgen) | |
| { | |
| echo "commitlint_log<<EOF_$UUID" | |
| cat commitlint.log | |
| echo "EOF_$UUID" | |
| } >> $GITHUB_OUTPUT | |
| - name: ๐ Fail if test failed | |
| if: steps.commitlint.outputs.is_success == 'false' | |
| run: exit 1 | |
| upload: | |
| runs-on: ubuntu-latest | |
| needs: lint-title | |
| if: success() || failure() | |
| steps: | |
| - name: ๐ Create comment | |
| env: | |
| ACTOR: ${{ github.actor }} | |
| COMMITLINT_LOG: ${{ needs.lint-title.outputs.commitlint_log }} | |
| IS_SUCCESS: ${{ needs.lint-title.outputs.is_success }} | |
| REPO: ${{ github.repository }} | |
| RUN_ID: ${{ github.run_id }} | |
| SHA: ${{ github.event.pull_request.head.sha }} | |
| WORKFLOW_NAME: ${{ github.workflow }} | |
| run: | | |
| UUID=$(uuidgen) | |
| if [ "$IS_SUCCESS" = "true" ]; then | |
| cat <<EOF_$UUID > comment.txt | |
| # โ Pull Request Title Linting Passed | |
| Thank you for updating the title of this pull request to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). | |
| <!-- generated-comment [$WORKFLOW_NAME](https://github.com/$REPO/.github/workflows/pull-request-title-lint.yml) --> | |
| EOF_$UUID | |
| else | |
| cat <<EOF_$UUID > comment.txt | |
| # โ Pull Request Title Linting Failed | |
| @$ACTOR, thank you for opening this pull request ๐๐ผ | |
| We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. | |
| <details> | |
| <summary><strong>Commitlint Log</strong></summary> | |
| \`\`\`shell | |
| $COMMITLINT_LOG | |
| \`\`\` | |
| </details> | |
| Please update the title of this pull request to follow the specification. | |
| ๐[View in Actions](https://github.com/$REPO/actions/runs/$RUN_ID) | |
| <!-- generated-comment [$WORKFLOW_NAME](https://github.com/$REPO/.github/workflows/pull-request-title-lint.yml) --> | |
| EOF_$UUID | |
| fi | |
| - name: ๐ข Create pull request number | |
| env: | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| echo "$PR_NUMBER" > pr_number.txt | |
| - name: ๐ Upload test comment | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: comment | |
| path: comment.txt | |
| - name: ๐ Upload pull request number | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pr_number | |
| path: pr_number.txt |