Files
element-plus/.github/workflows/lint-commit-message.yml
rzzf f7e6db47af ci: fix lint-commit-message not working for PR from fork (#22806)
* ci: fix lint-commit-message not working for PR from fork

* chore: upgrade

* ci: update
2025-11-15 10:02:59 +08:00

66 lines
1.7 KiB
YAML

name: Lint Commit Message
on:
pull_request:
types: [opened, edited, reopened]
jobs:
lint:
runs-on: ubuntu-latest
# if pull request title is D2M, then skip this job
if: ${{ !contains(github.event.pull_request.title, 'D2M') }}
continue-on-error: true
outputs:
failed: ${{ steps.lint_commit.outputs.failed == 'true' }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
PULL_REQUEST_AUTHOR: ${{ github.event.pull_request.user.login }}
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Lint commit
id: lint_commit
run: echo "${{ github.event.pull_request.title }}" | pnpm run lint:commit || echo "failed=true" >> $GITHUB_OUTPUT
- name: Set success result
if: ${{ steps.lint_commit.outputs.failed != 'true' }}
run: echo 'true' > ./lint-result.txt
- name: Set failed result
if: ${{ steps.lint_commit.outputs.failed == 'true' }}
run: echo 'false' > ./lint-result.txt
- name: Set PR number
run: echo "$PULL_REQUEST_NUMBER" > ./pr.txt
- name: Set PR author
run: echo "$PULL_REQUEST_AUTHOR" > ./author.txt
- uses: actions/upload-artifact@v5
with:
name: commit-lint-result
path: ./lint-result.txt
- uses: actions/upload-artifact@v5
with:
name: pr-number
path: ./pr.txt
- uses: actions/upload-artifact@v5
with:
name: pr-author
path: ./author.txt