Coder Social home page Coder Social logo

aslafy-z / conventional-pr-title-action Goto Github PK

View Code? Open in Web Editor NEW
84.0 3.0 34.0 16.06 MB

Ensure your PR title matches the Conventional Commits spec.

Home Page: https://github.com/marketplace/actions/conventional-pr-title

License: MIT License

JavaScript 97.14% Dockerfile 2.86%
github-actions conventional-commits conventional-changelog pull-requests pr-title hacktoberfest

conventional-pr-title-action's Introduction

Important Notice: This repository has been archived

Please note that no further updates or developments are planned for this repository in the future. The implementation and functionality constraints associated with the conventional-changelog packages and the limitations in the data extraction process have led to this decision. For those seeking a maintained and active alternative with mostly similar functionalities, it is recommended to switch to amannn/action-semantic-pull-request.

Thank you for your support and understanding.

Conventional PR Title Action

This is a GitHub Action that ensures your PR title matches the Conventional Commits spec.

This is helpful when you're using semantic-release with the Conventional Commits preset. When using the Squash and merge strategy, GitHub will suggest to use the PR title as the commit message. With this action you can validate that the PR title will lead to a correct commit message.

See Conventional Commits for sample titles.

Inputs

success-state

Optional. Description of the status check if validation succeeds.

Default: "Title follows the specification.".

failure-state

Optional. Description of the status check if validation fails.

Default: "Title does not follow the specification.".

context-name

Optional. Persistent status check context key.

Default: "conventional-pr-title".

preset

Optional. Conventional changelog preset.

Default: "[email protected]".

target-url

Optional. URL to be used when linking the "Details" in the actions overview.

Default: "https://www.conventionalcommits.org/en/v1.0.0/#summary".

Outputs

success

true if the validation succeed, false otherwise.

error

In case of an error (success=false), contains the error message for additional processing or usage in notifications.

Example usage

name: Check PR title

on:
  pull_request_target:
    types:
      - opened
      - reopened
      - edited
      - synchronize

jobs:
  lint:
    runs-on: ubuntu-latest
    permissions:
      statuses: write
    steps:
      - uses: aslafy-z/conventional-pr-title-action@v3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Note: Avoid using main ref, prefer to pin to a specific version.

Credits

All thanks goes to amannn's semantic-pull-request action.

conventional-pr-title-action's People

Contributors

aslafy-z avatar dependabot[bot] avatar dgutzmann avatar ephigenia avatar iamludal avatar omarfakhreddine avatar renovate[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

conventional-pr-title-action's Issues

npm ERR! code E409

Title fix(deps): update rust crate clap-verbosity-flag to 2.1.1 adheres to the conventional commits standards, but action output says otherwisse.

Affected PR: michidk/vscli#51

Run aslafy-z/conventional-pr-title-action@v3
  with:
    success-state: Title follows the specification.
    failure-state: Title does not follow the specification.
    context-name: conventional-pr-title
    preset: [email protected]
    target-url: https://www.conventionalcommits.org/en/v1.0.0/#summary
  env:
    GITHUB_TOKEN: ***
/usr/bin/docker run --name bfbe3f17ed031b913a48e9bbc644358bd2036c_90dc46 --label bfbe3f --workdir /github/workspace --rm -e "GITHUB_TOKEN" -e "INPUT_SUCCESS-STATE" -e "INPUT_FAILURE-STATE" -e "INPUT_CONTEXT-NAME" -e "INPUT_PRESET" -e "INPUT_TARGET-URL" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/vscli/vscli":"/github/workspace" bfbe3f:17ed031b913a48e9bbc644358bd2036c
Error: Command failed: npm install --quiet [email protected]
npm ERR! code E409
npm ERR! 409 Conflict - GET https://registry.npmjs.org/q/-/q-1.5.1.tgz

npm ERR! A complete log of this run can be found in: /github/home/.npm/_logs/2023-12-15T21_49_50_970Z-debug-0.log

Full logs:
logs_522.zip

Docs: Add permissions needed to run the action to README

Hi,

if a repo uses a resticted access it is neccessary to explicitely add permissions to use this action. Reading the code and from a first try on a private repo I guess in your case it is:

statuses: write

jobs:
  pr_title_check:
    permissions:
      statuses: write # <-- here
    runs-on: ubuntu-latest
    steps:
      - uses: aslafy-z/conventional-pr-title-action@v3
        with:
          preset: [email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update dependency set-value to 4.0.1 [security]

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

"feat!:" prefix not supported

The "feat!:" prefix (feature with a breaking change) is not supported, despite being mentioned in the "No release type found" error message:

Add a prefix like "fix: ", "feat: " or "feat!: " to indicate what kind of release this pull request corresponds to. The title should match the commit mesage format as specified by https://www.conventionalcommits.org/.

#235 adds a failing test to illustrate this issue.

Not using custom preset

I've just started using this action and was hoping to use a custom preset, but it seems that preset is not being used. Can you confirm using the logs below?

2021-09-02T21:29:59.6067270Z Found online and idle hosted runner in the current repository's organization account that matches the required labels: 'ubuntu-latest'
2021-09-02T21:29:59.7921899Z Waiting for a Hosted runner in the 'organization' to pick this job...
2021-09-02T21:30:00.3419097Z Job is waiting for a hosted runner to come online.
2021-09-02T21:30:03.1967045Z Job is about to start running on the hosted runner: GitHub Actions 2 (hosted)
2021-09-02T21:30:07.0252510Z Current runner version: '2.280.3'
2021-09-02T21:30:07.0279216Z ##[group]Operating System
2021-09-02T21:30:07.0280079Z Ubuntu
2021-09-02T21:30:07.0280526Z 20.04.3
2021-09-02T21:30:07.0280908Z LTS
2021-09-02T21:30:07.0281382Z ##[endgroup]
2021-09-02T21:30:07.0281884Z ##[group]Virtual Environment
2021-09-02T21:30:07.0282551Z Environment: ubuntu-20.04
2021-09-02T21:30:07.0283050Z Version: 20210831.9
2021-09-02T21:30:07.0284023Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210831.9/images/linux/Ubuntu2004-README.md
2021-09-02T21:30:07.0285335Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20210831.9
2021-09-02T21:30:07.0286132Z ##[endgroup]
2021-09-02T21:30:07.0286761Z ##[group]Virtual Environment Provisioner
2021-09-02T21:30:07.0287351Z 1.0.0.0-master-20210816-1
2021-09-02T21:30:07.0287879Z ##[endgroup]
2021-09-02T21:30:07.0289682Z ##[group]GITHUB_TOKEN Permissions
2021-09-02T21:30:07.0290981Z Actions: write
2021-09-02T21:30:07.0291501Z Checks: write
2021-09-02T21:30:07.0291951Z Contents: write
2021-09-02T21:30:07.0292480Z Deployments: write
2021-09-02T21:30:07.0292992Z Discussions: write
2021-09-02T21:30:07.0293526Z Issues: write
2021-09-02T21:30:07.0294019Z Metadata: read
2021-09-02T21:30:07.0294475Z Packages: write
2021-09-02T21:30:07.0295015Z PullRequests: write
2021-09-02T21:30:07.0295595Z RepositoryProjects: write
2021-09-02T21:30:07.0296245Z SecurityEvents: write
2021-09-02T21:30:07.0296743Z Statuses: write
2021-09-02T21:30:07.0297330Z ##[endgroup]
2021-09-02T21:30:07.0300052Z Prepare workflow directory
2021-09-02T21:30:07.0879605Z Prepare all required actions
2021-09-02T21:30:07.0888566Z Getting action download info
2021-09-02T21:30:07.2761326Z Download action repository 'aslafy-z/conventional-pr-title-action@master' (SHA:da8f29a36764af935378bfe7e30ae4dcf692547a)
2021-09-02T21:30:09.2734736Z ##[group]Build container for action use: '/home/runner/work/_actions/aslafy-z/conventional-pr-title-action/master/Dockerfile'.
2021-09-02T21:30:09.2778942Z ##[command]/usr/bin/docker build -t c9e036:d4f9ee4cc30d478386af13dc10b5ae50 -f "/home/runner/work/_actions/aslafy-z/conventional-pr-title-action/master/Dockerfile" "/home/runner/work/_actions/aslafy-z/conventional-pr-title-action/master"
2021-09-02T21:30:10.1857790Z Sending build context to Docker daemon  477.7kB
2021-09-02T21:30:10.1915076Z 
2021-09-02T21:30:10.1915685Z Step 1/5 : FROM node:13-alpine
2021-09-02T21:30:10.1916374Z 13-alpine: Pulling from library/node
2021-09-02T21:30:10.1917340Z cbdbe7a5bc2a: Pulling fs layer
2021-09-02T21:30:10.1918021Z 780514bed1ad: Pulling fs layer
2021-09-02T21:30:10.1918624Z 5d74fb112a7d: Pulling fs layer
2021-09-02T21:30:10.1919405Z 4b9536424fa1: Pulling fs layer
2021-09-02T21:30:10.1919959Z 4b9536424fa1: Waiting
2021-09-02T21:30:10.1920550Z cbdbe7a5bc2a: Verifying Checksum
2021-09-02T21:30:10.1921285Z cbdbe7a5bc2a: Download complete
2021-09-02T21:30:10.1921945Z 5d74fb112a7d: Verifying Checksum
2021-09-02T21:30:10.1922570Z 5d74fb112a7d: Download complete
2021-09-02T21:30:10.1923197Z 4b9536424fa1: Verifying Checksum
2021-09-02T21:30:10.1923811Z 4b9536424fa1: Download complete
2021-09-02T21:30:10.1924412Z cbdbe7a5bc2a: Pull complete
2021-09-02T21:30:10.3846233Z 780514bed1ad: Verifying Checksum
2021-09-02T21:30:10.3847094Z 780514bed1ad: Download complete
2021-09-02T21:30:12.2683776Z 780514bed1ad: Pull complete
2021-09-02T21:30:12.4081736Z 5d74fb112a7d: Pull complete
2021-09-02T21:30:12.4577314Z 4b9536424fa1: Pull complete
2021-09-02T21:30:12.4623207Z Digest: sha256:527c70f74817f6f6b5853588c28de33459178ab72421f1fb7b63a281ab670258
2021-09-02T21:30:12.4643276Z Status: Downloaded newer image for node:13-alpine
2021-09-02T21:30:12.4662529Z  ---> 8216bf4583a5
2021-09-02T21:30:12.4663722Z Step 2/5 : ADD package.json package-lock.json /action/
2021-09-02T21:30:13.0181362Z  ---> 872bfd9785b4
2021-09-02T21:30:13.0195677Z Step 3/5 : RUN cd /action && npm ci
2021-09-02T21:30:13.0406815Z  ---> Running in ca2fd83db726
2021-09-02T21:30:19.6770364Z added 1035 packages in 5.984s
2021-09-02T21:30:28.2783396Z Removing intermediate container ca2fd83db726
2021-09-02T21:30:28.2784786Z  ---> f023d989b845
2021-09-02T21:30:28.2799723Z Step 4/5 : ADD src /action/src
2021-09-02T21:30:29.5357269Z  ---> 19024af3c277
2021-09-02T21:30:29.5358624Z Step 5/5 : ENTRYPOINT ["node", "/action/src/index.js"]
2021-09-02T21:30:29.5612162Z  ---> Running in 4e58e53207fa
2021-09-02T21:30:30.7595572Z Removing intermediate container 4e58e53207fa
2021-09-02T21:30:30.7597631Z  ---> eb877995005e
2021-09-02T21:30:30.7623021Z Successfully built eb877995005e
2021-09-02T21:30:30.7663014Z Successfully tagged c9e036:d4f9ee4cc30d478386af13dc10b5ae50
2021-09-02T21:30:30.7706486Z ##[endgroup]
2021-09-02T21:30:30.7986861Z ##[group]Run aslafy-z/conventional-pr-title-action@master
2021-09-02T21:30:30.7987629Z with:
2021-09-02T21:30:30.7988140Z   success-state: Title follows the specification.
2021-09-02T21:30:30.7988824Z   failure-state: Title does not follow the specification.
2021-09-02T21:30:30.7989509Z   context-name: conventional-pr-title
2021-09-02T21:30:30.7990246Z   preset: conventional-changelog-beemo
2021-09-02T21:30:30.7990767Z env:
2021-09-02T21:30:30.7992089Z   GITHUB_TOKEN: ***
2021-09-02T21:30:30.7992451Z ##[endgroup]
2021-09-02T21:30:30.8037538Z ##[command]/usr/bin/docker run --name c9e036d4f9ee4cc30d478386af13dc10b5ae50_c34ca9 --label c9e036 --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_SUCCESS-STATE -e INPUT_FAILURE-STATE -e INPUT_CONTEXT-NAME -e INPUT_PRESET -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/xxxxx/yyyyy":"/github/workspace" c9e036:d4f9ee4cc30d478386af13dc10b5ae50
2021-09-02T21:30:39.2870353Z ##[error]Unknown release type "feature" found in pull request title "feature: DFT-406 Add new function to trigger email send for proposal creation".

Please use one of these recognized types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.
2021-09-02T21:30:39.4148192Z Cleaning up orphan processes

The workflow source looks like this:

name: Check PR title
on:
  pull_request:
    types: [opened, synchronize, reopened, edited]

jobs:
  lint_title:
    runs-on: ubuntu-latest
    steps:
      - uses: aslafy-z/conventional-pr-title-action@master
        with:
          success-state: Title follows the specification.
          failure-state: Title does not follow the specification.
          context-name: conventional-pr-title
          preset: conventional-changelog-beemo
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

From what I can see, the conventional-changelog-beemo preset is not being installed despite it being specified in the workflow, but from the looks of the source code, it should work.

Have I done something wrong or is there a bug with the action?

Unknown issue with preset

This may be an issue with the preset itself rather than the consumption of it, but this CI run is failing when trying to use the "breaking" tag with the "eslint" preset. In the action run details it says "Please use one of these recognized types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.", which seems to indicate that the stated tags used by the preset aren't necessarily being recognized somehow.

I'd love to understand how to get around this and whether or not I should be raising an issue with the preset itself.

Possible to not report status twice

Is it possible to not show the first status? It really is not a status but shows up because the actual status (the 2nd one) uses a different context than the first (I guess).

image

The action fails to validate a commit message with prefix/type `feat!:`

As can be seen in this action run here: https://github.com/speakeasy-api/speakeasy/actions/runs/3891915784/jobs/6642719562

The commit title is feat!: add auth requirement to the CLI

But the below error is returned:

Error: No release type found in pull request title "feat!: add auth requirement to the CLI".

Add a prefix like "fix: ", "feat: " or "feat!: " to indicate what kind of release this pull request corresponds to. The title should match the commit mesage format as specified by [https://www.conventionalcommits.org/.](https://www.conventionalcommits.org/)

It even gives an example of using feat!: in the error response

How to indicate breaking change?

I see this in the tests

    "fix: Fix bug\n\nBREAKING CHANGE: Fix bug",

But there is no way to have a multi line PR title, so no way to indicate a breaking change.. right?

How to trigger this action rerun after fixing the PR title

The PR was made with a title not matches the convention. So the action failed.

After changing the title, how can we rerun this action with the new title?

GitHub action provides the button to "Re-run all jobs", but the conventional-pr-title action still failed. It seems that the action still checks against the previous wrong title.

/bin/sh: 1: npm: not found

Hello, thanks for this great action!

We've been using this for quite some time without any issues. Suddenly, since recent hours, we started to see this error:
image

Error: Command failed: npm install --quiet conventional-changelog-angular@latest
/bin/sh: 1: npm: not found

We suspect this may have to do with the latest release from #267. Was there anything intended for us to change on our side for using the latest release?

Success Output is reversed

The Success Output success is reversed. It returns true if the check failed and false if the check succeeded.
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.