Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pr-title-check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# `pr-title-check` GitHub Action

This action validates pull request titles by checking them for typos (using [typos](https://github.com/crate-ci/typos)) and verifying they follow the [Conventional Commits](https://www.conventionalcommits.org/) format (using [action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request)).

The action checks out the repository so that any `_typos.toml` configuration present in the repo is respected.

## Usage

```yaml
name: CI (PR)

on:
pull_request:

permissions:
contents: read
pull-requests: read

jobs:
pr-title-check:
name: PR title check
runs-on: ubuntu-latest
steps:
- uses: apify/actions/pr-title-check@main
```

### Inputs

- `github-token` (optional, default `${{ github.token }}`) — Token used by the semantic PR title check to read PR metadata via the GitHub API.
30 changes: 30 additions & 0 deletions pr-title-check/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "PR title check"
description: "Check PR title for typos and conventional commit format"

inputs:
github-token:
description: "GitHub token for the semantic PR title check"
required: false
default: ${{ github.token }}

runs:
using: "composite"
steps:
# Needed to access `_typos.toml` from the repository
- uses: actions/checkout@v4
Comment thread
janbuchar marked this conversation as resolved.

- name: Write PR title to file
shell: bash
run: echo "$PR_TITLE" > /tmp/pr-title.txt
env:
PR_TITLE: ${{ github.event.pull_request.title }}

- name: Spell-check PR title
uses: crate-ci/typos@master
with:
files: /tmp/pr-title.txt

- name: Check PR title follows conventional commits
uses: amannn/action-semantic-pull-request@v6.1.1
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
Loading