{"id":13483693,"url":"https://github.com/wagoid/commitlint-github-action","last_synced_at":"2025-03-27T14:31:30.627Z","repository":{"id":36955113,"uuid":"212203144","full_name":"wagoid/commitlint-github-action","owner":"wagoid","description":"Lints Pull Request commits with commitlint","archived":false,"fork":false,"pushed_at":"2024-09-04T15:19:37.000Z","size":11260,"stargazers_count":362,"open_issues_count":12,"forks_count":56,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T01:59:47.620Z","etag":null,"topics":["github-actions","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/wagoid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2019-10-01T21:29:55.000Z","updated_at":"2024-10-29T14:30:18.000Z","dependencies_parsed_at":"2024-01-08T13:51:00.338Z","dependency_job_id":"a001cecb-e34a-44a9-a347-08e343950efa","html_url":"https://github.com/wagoid/commitlint-github-action","commit_stats":{"total_commits":356,"total_committers":23,"mean_commits":"15.478260869565217","dds":0.7134831460674158,"last_synced_commit":"3d28780bbf0365e29b144e272b2121204d5be5f3"},"previous_names":[],"tags_count":101,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoid%2Fcommitlint-github-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoid%2Fcommitlint-github-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoid%2Fcommitlint-github-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoid%2Fcommitlint-github-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wagoid","download_url":"https://codeload.github.com/wagoid/commitlint-github-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245298593,"owners_count":20592645,"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":["github-actions","hacktoberfest"],"created_at":"2024-07-31T17:01:14.246Z","updated_at":"2025-03-27T14:31:30.615Z","avatar_url":"https://github.com/wagoid.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Community Resources"],"sub_categories":["Static Analysis"],"readme":"# Commitlint Github Action\n\nLints Pull Request commits with [commitlint](https://commitlint.js.org/).\n\n## Usage\n\nCreate a GitHub workflow in the `.github` folder, e.g. `.github/workflows/commitlint.yml`:\n\n```yaml\nname: Lint Commit Messages\non: [pull_request]\n\npermissions:\n  contents: read\n  pull-requests: read\n\njobs:\n  commitlint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: wagoid/commitlint-github-action@v6\n```\n\nAlternatively, you can run on other event types such as `on: [push]`. In that case, the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine `push` and `pull_request` together in the same workflow.\n\n### Using with GitHub Merge Queues\n\nGitHub's [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) is a feature that allows you to queue pull requests for merging once they meet certain criteria. When using merge queues, you need to ensure that your workflows are set up to handle the merge_group event, which is triggered when pull requests are added to the merge queue.\n\n#### Workflow Configuration\n\nTo use the commitlint-github-action with merge queues, you need to set up a workflow that listens to the merge_group event. Here's an example of how to configure your workflow:\n\n```yaml\nname: Lint Commit Messages in Merge Queue\n\non:\n  merge_group:\n    types:\n      - checks_requested\n\njobs:\n  commitlint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          ref: ${{ github.sha }}\n\n      - uses: wagoid/commitlint-github-action@v6\n```\n\n#### Important Note:\n\nTo ensure that the merge_group event triggers correctly, you need to have **at least one workflow that responds to the pull_request event** with a job named the same as the one in your merge_group workflow (**commitlint** in this example). This is necessary because the merge queue relies on the existence of status checks from the pull request context.\n\nHere's a minimal pull_request workflow to satisfy this requirement:\n\n```yaml\nname: Placeholder Workflow for Merge Queue\n\non:\n  pull_request:\n\njobs:\n  commitlint:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout Repository\n        uses: actions/checkout@v4\n```\n\nThis workflow can also be a meaningful one that checks out the commits in your PR and runs other checks, but it must have a job named **commitlint**.\n\n### Enabling Merge Queues in Your Repository\n\nBefore you can use merge queues, you need to enable the feature in your repository settings:\n\n- Go to your repository's Settings \u003e Branches.\n- Under Branch protection rules, edit the rule for your target branch (e.g. master).\n- Enable Require merge queue.\n- Specify your new job (e.g. commitlint) and any other required status checks, that must pass before merging.\n\nFor more information on configuring merge queues, refer to the [GitHub documentation on managing a merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue).\n\n## Inputs\n\nYou can supply these inputs to the `wagoid/commitlint-github-action@v6` step.\n\n### `configFile`\n\nThe path to your commitlint config file.\n\nDefault: `commitlint.config.mjs`\n\nIf the config file doesn't exist, [config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) settings will be loaded as a default fallback.\n\nDetails on the configuration file can be found on [the commitlint website](https://commitlint.js.org/#/reference-configuration).\n\nNote: `commitlint.config.js` doesn't work with this action. If you use a JS config file, it's required to be an ES Module (`.mjs` extension)\n\n### `failOnWarnings`\n\nWhether you want to fail on warnings or not.\n\nDefault: `false`\n\n### `failOnErrors`\n\nWhether you want to fail on errors or not. Still outputs the results, just forces the action to pass even if errors are detected.\n\nDefault: `true`\n\n### `helpURL`\n\nLink to a page explaining your commit message convention.\n\ndefault: `https://github.com/conventional-changelog/commitlint/#what-is-commitlint`\n\n### `commitDepth`\n\nWhen set to a valid Integer value - X, considers only the latest X number of commits.\n\ndefault: `null` (Equivalent to linting all commits)\n\n### `token`\n\nPersonal access token (PAT) used to interact with the GitHub API.\nBy default, the automatic token provided by GitHub is used.\nYou can see more info about GitHub's default token [here](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token).\n\ndefault: `${{ github.token }}`\n\n## Outputs\n\n### `results`\n\nThe error and warning messages for each one of the analyzed commits. This is useful if you want to use the commitlint results in a JSON format in other jobs. See [the documentation](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#fromjson) on how to read JSON information from outputs.\n\nBelow you can see an example text output together with its corresponding JSON output:\n\n```\nYou have commit messages with errors\n\n⧗   input: wrong message\n✖   subject may not be empty [subject-empty]\n✖   type may not be empty [type-empty]\n\n✖   found 2 problems, 0 warnings\nⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint\n\n⧗   input: chore: my message\n⚠   body must have leading blank line [body-leading-blank]\n\n⚠   found 0 problems, 1 warnings\nⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint\n```\n\n```JSON\n[\n  {\n    \"hash\": \"cb0f846f13b490c2fd17bd5ed0b6f65ba9b86c75\",\n    \"message\": \"wrong message\",\n    \"valid\": false,\n    \"errors\": [\"subject may not be empty\", \"type may not be empty\"],\n    \"warnings\": [],\n  },\n  {\n    \"hash\": \"cb14483cbde23b61322ffb8d3fcdc87f514a3141\",\n    \"message\": \"chore: my message\\n\\nsome context without leading blank line\",\n    \"valid\": true,\n    \"errors\": [],\n    \"warnings\": [\"body must have leading blank line\"],\n  },\n]\n```\n\n## About `extends` in your config file\n\nThis is a [`Docker` action](https://github.com/actions/toolkit/blob/e2adf403d6d14a9ca7474976ccaca20f72ff8209/docs/action-types.md#why-would-i-choose-a-docker-action), and was made like this so that you can run it with minimum setup, regardless of your repo's environment. It comes packed with the most famous shared configurations that you can use in your commitlint config's `extends` field:\n\n- [@commitlint/config-angular](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-angular)\n- [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional)\n- [@commitlint/config-lerna-scopes](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-lerna-scopes)\n- [@commitlint/config-patternplate](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-patternplate)\n- [conventional-changelog-lint-config-canonical](https://github.com/gajus/conventional-changelog-lint-config-canonical)\n- [commitlint-config-jira](https://github.com/Gherciu/commitlint-jira)\n- [commitlint-config-function-rules](https://github.com/vidavidorra/commitlint-plugin-function-rules#readme)\n\nApart from the shared configurations that are included by default, you can also include extra dependencies for other configs and plugins that you want to use.\n\nIn order to do so, you can use `NODE_PATH` env var to make the action take those dependencies into account. Below is an example workflow that does that.\n\n```yaml\nname: Lint Commit Messages\non: [pull_request]\n\npermissions:\n  contents: read\n  pull-requests: read\n\njobs:\n  commitlint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '22'\n      - run: npm install\n      # Run the commitlint action, considering its own dependencies and yours as well 🚀\n      # `github.workspace` is the path to your repository.\n      - uses: wagoid/commitlint-github-action@v6\n        env:\n          NODE_PATH: ${{ github.workspace }}/node_modules\n```\n\n---\n\n💡 You can see other ways to install your dependencies (including private ones) in [the Setup Node action's docs](https://github.com/actions/setup-node).\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwagoid%2Fcommitlint-github-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwagoid%2Fcommitlint-github-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwagoid%2Fcommitlint-github-action/lists"}