-
Notifications
You must be signed in to change notification settings - Fork 10
chore: Split actions for validate title to use pull_request_target in limited scope
#1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,25 @@ | ||
| name: Check PR title | ||
| name: Semantic PR title check | ||
|
|
||
| on: | ||
| pull_request: | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - edited | ||
| - synchronize | ||
| - labeled | ||
| - unlabeled | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/check_pr_title.yml' | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| main: | ||
| name: Semantic check | ||
| runs-on: ubuntu-slim | ||
| permissions: | ||
| statuses: write | ||
| pull-requests: read | ||
| steps: | ||
| - uses: aslafy-z/conventional-pr-title-action@v3 | ||
| - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| spellcheck: | ||
| runs-on: ubuntu-slim | ||
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip check PR title') }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
|
||
|
|
||
| - name: Install aspell | ||
| run: sudo apt-get update && sudo apt-get install aspell | ||
|
|
||
| - name: Check PR title spelling | ||
| env: | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| echo "$PR_TITLE" | ||
| if aspell --personal="./.github/project_dict.pws" list <<< "$PR_TITLE" | grep -q .; then | ||
| echo "Misspelled words found." | ||
| aspell --personal="./.github/project_dict.pws" list <<< "$PR_TITLE" | ||
| exit 1 | ||
| else | ||
| echo "No misspelled words found." | ||
| exit 0 | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Spellcheck PR title | ||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, edited, synchronize, labeled, unlabeled] | ||
| paths: | ||
|
Comment on lines
+2
to
+5
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): The If you want this workflow to validate titles on all relevant PRs (except those explicitly skipped), remove the |
||
| - '.github/workflows/spellcheck_title.yml' | ||
|
|
||
| jobs: | ||
| spellcheck: | ||
| runs-on: ubuntu-slim | ||
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip check PR title') }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
|
||
|
|
||
| - name: Install aspell | ||
| run: sudo apt-get update && sudo apt-get install aspell | ||
|
|
||
| - name: Check PR title spelling | ||
| env: | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| echo "$PR_TITLE" | ||
| if aspell --personal="./.github/project_dict.pws" list <<< "$PR_TITLE" | grep -q .; then | ||
| echo "Misspelled words found." | ||
| aspell --personal="./.github/project_dict.pws" list <<< "$PR_TITLE" | ||
| exit 1 | ||
| else | ||
| echo "No misspelled words found." | ||
| exit 0 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Remove the
pathsfilters from both title-validation workflows.Each filter allows the workflow to run only when its own workflow file changes. As a result, normal pull requests—including title-only edits—skip semantic or spelling validation. Remove the
pathsentries from this workflow and.github/workflows/spellcheck_title.ymlso title checks run for all intended pull request events.📍 Affects 2 files
.github/workflows/check_pr_title.yml#L4-L4(this comment).github/workflows/spellcheck_title.yml#L3-L6🤖 Prompt for AI Agents