{"id":15656985,"url":"https://github.com/thehanimo/pr-title-checker","last_synced_at":"2025-05-16T15:03:23.739Z","repository":{"id":37311265,"uuid":"287533723","full_name":"thehanimo/pr-title-checker","owner":"thehanimo","description":"An action to automatically check if pull request titles conform to Contribution Guidelines","archived":false,"fork":false,"pushed_at":"2024-11-25T04:22:58.000Z","size":926,"stargazers_count":118,"open_issues_count":6,"forks_count":38,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T12:09:11.945Z","etag":null,"topics":["contribution-guidelines","pull-requests","styling"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thehanimo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["thehanimo"]}},"created_at":"2020-08-14T12:59:38.000Z","updated_at":"2025-03-27T07:13:20.000Z","dependencies_parsed_at":"2025-01-17T16:09:57.266Z","dependency_job_id":"1457b331-131d-48d5-8a23-cdaec8a5121f","html_url":"https://github.com/thehanimo/pr-title-checker","commit_stats":{"total_commits":52,"total_committers":7,"mean_commits":7.428571428571429,"dds":0.1923076923076923,"last_synced_commit":"7fbfe05602bdd86f926d3fb3bccb6f3aed43bc70"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehanimo%2Fpr-title-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehanimo%2Fpr-title-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehanimo%2Fpr-title-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehanimo%2Fpr-title-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thehanimo","download_url":"https://codeload.github.com/thehanimo/pr-title-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248564940,"owners_count":21125412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contribution-guidelines","pull-requests","styling"],"created_at":"2024-10-03T13:04:58.430Z","updated_at":"2025-04-12T11:50:00.476Z","avatar_url":"https://github.com/thehanimo.png","language":"TypeScript","funding_links":["https://github.com/sponsors/thehanimo"],"categories":[],"sub_categories":[],"readme":"# Pull Request Title Checker\n\n\u003c!-- prettier-ignore --\u003e\nThis action checks if PR titles conform to the Contribution Guidelines :ballot_box_with_check: \u003cbr/\u003e\u003cbr/\u003e\nConsistent title names help maintainers organise their projects better :books: \u003cbr/\u003e\u003cbr/\u003e\nShows if the author has _reaaaaally_ read the Contribution Guidelines :P\n\n## Usage\n\nCreate a config file `.github/pr-title-checker-config.json` like this one below:\n\n```json\n{\n  \"LABEL\": {\n    \"name\": \"title needs formatting\",\n    \"color\": \"EEEEEE\"\n  },\n  \"CHECKS\": {\n    \"prefixes\": [\"fix: \", \"feat: \"],\n    \"regexp\": \"docs\\\\(v[0-9]\\\\): \",\n    \"regexpFlags\": \"i\",\n    \"ignoreLabels\" : [\"dont-check-PRs-with-this-label\", \"meta\"]\n  },\n  \"MESSAGES\": {\n    \"success\": \"All OK\",\n    \"failure\": \"Failing CI test\",\n    \"notice\": \"\"\n  }\n}\n```\nYou can pass in one of `prefixes` or `regexp` or even both based on your use case. `regexpFlags` and `ignoreLables` are optional fields.\n\nIf `LABEL.name` is set to `\"\"`, adding or removing labels will be skipped. The CI test will continue to pass/fail accordingly.\n\nIf none of the checks pass, a label will be added to that pull request. \\\nIf at least one of them passes, the label will be removed.\n\nThis action causes CI tests to fail by default. However, if you do not want CI tests failing just because of this action, simply set `alwaysPassCI` as true in the CHECKS field. **An invalid config file will always cause the action to fail.**\n\nAdding label names to the optional `ignoreLabels` field will forfeit any checks for PRs with those labels.\n\nThe config file is always pulled from the action's context, i.e., the branch from which the pull request is made.\n\nSee [other ways to specify config file.](#other-ways-to-specify-config-file)\n\nAction returns a single output: `success` that indicates if check has passed or failed.\n\n## Create Workflow\n\nCreate a workflow file (eg: `.github/workflows/pr-title-checker.yml`) with the following content:\n\n```yaml\nname: \"PR Title Checker\"\non:\n  pull_request_target:\n    types:\n      - opened\n      - edited\n      - synchronize\n      - labeled\n      - unlabeled\n\njobs:\n  check:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: thehanimo/pr-title-checker@v1.4.3\n        with:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          pass_on_octokit_error: false\n          configuration_path: .github/pr-title-checker-config.json #(optional. defaults to .github/pr-title-checker-config.json)\n```\n\nTo learn more about workflows, see [Create an example workflow.](https://docs.github.com/en/actions/using-workflows/about-workflows#create-an-example-workflow)\n\n## Other ways to specify config file\n\n### 1. Remote URL to a valid JSON file\n```yaml\n...\n    steps:\n      - uses: thehanimo/pr-title-checker@v1.4.3\n        with:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          pass_on_octokit_error: false\n          remote_configuration_path: \"https://raw.githubusercontent.com/grpc/grpc/master/.github/pr_title_checker_config.json\"\n...\n```\nNote that this has to be a url pointing to a valid, raw json file. See [#28](https://github.com/thehanimo/pr-title-checker/issues/28)\n\n### 2. Config file in a GitHub repo\n```yaml\n...\n    steps:\n      - uses: thehanimo/pr-title-checker@v1.4.3\n        with:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          pass_on_octokit_error: false\n          github_configuration_owner: RocketChat #(optional. defaults to the owner of the repo in which the action is run)\n          github_configuration_repo: Rocket.Chat #(optional. defaults to the repo in which the action is run)\n          github_configuration_path: .github/pr-title-checker-config.json #(optional. defaults to .github/pr-title-checker-config.json)\n          github_configuration_ref: \u003cnamed branch, tag, or SHA\u003e #(optional. defaults to the latest commit on the default branch or, if the repo specified is the same as the one on which the action is running, it defaults to the current context's sha)\n          github_configuration_token: ${{ secrets.YOUR_TOKEN }} #(optional. defaults to GITHUB_TOKEN)\n...\n```\n\n### 3. Config file in the local file system of the action\n```yaml\n...\n    steps:\n      - uses: thehanimo/pr-title-checker@v1.4.3\n        with:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          pass_on_octokit_error: false\n          local_configuration_path: .github/actions/enforce-pr-titles/config.json\n...\n```\nThis is useful if a repo containing the config file is pulled in a previous step using, for e.g., actions/checkout. See [#36](https://github.com/thehanimo/pr-title-checker/issues/36)\n\n### Using output result\n\nYou can use the action output to execute follow up steps e.g. adding a comment.\n\n```yml\n    steps:\n      - uses: thehanimo/pr-title-checker@v1.4.3\n        id: check\n        continue-on-error: true\n        with:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          pass_on_octokit_error: false\n      \n      - name: Add comment to fix PR title\n        uses: marocchino/sticky-pull-request-comment@v2\n        if: ${{ steps.check.outputs.success == 'false'}}\n        with:\n          header: 'PR Title Check'\n          recreate: true\n          message: |\n              ### 🚨 PR Title Needs Formatting\n              The title of this PR needs to be formatted correctly and include an Azure Boards Reference. \n              Please update the title to match the format `type: description AB#xxx`. Examples:\n              * `bugfix: fix typo in README.md AB#123`\n              * `chore: update dependencies AB#456`\n              * `feat: add new feature AB#789`\n              * `chore: fixing build pipeline` - no AB reference\n\n      - name: Add comment that PR title is fixed\n        if: ${{ steps.check.outputs.success == 'true'}}\n        uses: marocchino/sticky-pull-request-comment@v2\n        with:\n          header: 'PR Title Check'\n          recreate: true\n          message: |\n              ### ✅ PR Title Formatted Correctly\n              The title of this PR has been updated to match the correct format. Thank you!\n```\n\n## NOTE:\n* [`pull_request_target`](https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request_target) event trigger should be used (not [`pull_request`](https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request)) in order to support checking PRs from forks. This was added in `v1.3.2`. See [#8.](https://github.com/thehanimo/pr-title-checker/issues/8)\n* `pass_on_octokit_error` is an optional input which defaults to false. Setting it to true will prevent the CI from failing when an octokit error occurs. This is useful when the environment this action is run in is not consistent. For e.g, it could be a missing GITHUB_TOKEN. Thanks to [@bennycode](https://github.com/bennycode) for pointing this out.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehanimo%2Fpr-title-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthehanimo%2Fpr-title-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehanimo%2Fpr-title-checker/lists"}