Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

refactor: ♻️ developer experience #1021

refactor: ♻️ developer experience

refactor: ♻️ developer experience #1021

# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
---
name: Validate pull request
permissions:
pull-requests: write
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
jobs:
validate:
name: Validate pull request title and contents
runs-on: ubuntu-latest
steps:
- name: Check out codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts --workspace-root
- name: Lint pull request title
run: echo ${{ toJSON(github.event.pull_request.title) }} | npx --no -- commitlint
- name: Format pull request title
id: devmoji
run: |
TITLE=$(npx --no -- devmoji --config devmoji.config.cjs --text ${{ toJSON(github.event.pull_request.title) }})
echo "TITLE=$TITLE" >> $GITHUB_OUTPUT
- name: Update pull request title if needed
if: toJSON(github.event.pull_request.title) != toJSON(steps.devmoji.outputs.TITLE)
uses: octokit/[email protected]
with:
route: PATCH /repos/{owner}/{repo}/pulls/{pull_number}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
pull_number: ${{ github.event.number }}
title: ${{ toJSON(steps.devmoji.outputs.TITLE) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}