GithubHelp home page GithubHelp logo

Comments (6)

zeke avatar zeke commented on June 2, 2024 1

I did a little research on this today and discovered that a very similar action already exists!

https://github.com/amannn/action-semantic-pull-request

@amannn and @hanno-jonlay I see you've contributed to that project. Would you be okay with me updating the REAMDE of this project to mention your Action as an alternative?

from semantic-pull-requests.

Vlaaaaaaad avatar Vlaaaaaaad commented on June 2, 2024 1

I was unhappy with the pre-existing GitHub Actions( weird emoji support) and I looked a bit into this. I ended up just using an if on the PR title. It's not pretty, but it works.

As it'll be a while until I open-source the project using these actions, here's the relevant code:

name: Conformance

on:
  pull_request:
    types: [opened, synchronize, edited]

...

steps:
  - name: PR title is valid
    if: >
      startsWith(github.event.pull_request.title, '📦 ') ||
      startsWith(github.event.pull_request.title, '🐛 ') ||
      startsWith(github.event.pull_request.title, '👌 ') ||
      startsWith(github.event.pull_request.title, '🚀 ') ||
      startsWith(github.event.pull_request.title, '‼️ ') ||
      startsWith(github.event.pull_request.title, '⬆️ ')
    run: |
      echo 'Title checks passed'

  - name: PR title is invalid
    if: >
      !startsWith(github.event.pull_request.title, '📦 ') &&
      !startsWith(github.event.pull_request.title, '🐛 ') &&
      !startsWith(github.event.pull_request.title, '👌 ') &&
      !startsWith(github.event.pull_request.title, '🚀 ') &&
      !startsWith(github.event.pull_request.title, '‼️ ') &&
      !startsWith(github.event.pull_request.title, '⬆️ ')
    run: |
      echo 'Pull request title is not valid. See .github/PULL_REQUEST_TEMPLATE/pull_request_template.md for details'
      exit 1

At one point I was even commenting back on the PR for more visibility, but I thought that was a bit much:

- name: Comment for PR title conformance
  if: failure()
  uses: peter-evans/create-or-update-comment@v1
  with:
    issue-number: ${{tojson(github.event.number)}}
    body: |
      Please ensure your PR title starts with an icon:
        📦 New things / new features / new docs
        🐛 Fix existing thing / bug fixes
        👌 Improve something / refactor
        🚀 Release / ship / deploy
        ‼️ Breaking changes / user involvement requires / manual delivery steps
        ⬆️ Dependency updates / tooling bumps

      PR titles should be, in order of importance:
        - imperative( _add_ instead of _added_)
        - explicit
        - short

      Examples of PR titles:
        📦 Add yaml support
        📦 Add Firefox browser tests
        📦 Tutorial for API Interface
        📦 ADR: Use Terraform for IaC
        📦 Add automated CHANGELOG
        🐛 Fix conversion failure for Italian
        🐛 Stop panic on baldy formatted input
        👌 Improve handling of JPEG files
        👌 Link to PRs in CHANGELOG
        👌 Refactor event routing
        ‼️ Change API response codes
        ⬆️ Bump json from v5 to v6

from semantic-pull-requests.

zeke avatar zeke commented on June 2, 2024

Side note: I see this in the README

Note that since PR titles only have a single line, you have to use the ! syntax for breaking changes.

Does semantic-release already support that as an alternative to BREAKING CHANGE: in the commit body? If so, that's very exciting news.

from semantic-pull-requests.

hanno-jonlay avatar hanno-jonlay commented on June 2, 2024

Not sure I can say much here, since my contribution was amusingly tiny: amannn/action-semantic-pull-request@08fc3f6

Fun to hear you mention this, however, as I spent a bit of time considering your app before we eventually settled on @amannn's action instead. So I think that for other newbies, a comment in the README would have been useful.

from semantic-pull-requests.

amannn avatar amannn commented on June 2, 2024

Would you be okay with me updating the REAMDE of this project to mention your Action as an alternative?

Of course! 🙂

Does semantic-release already support that as an alternative to BREAKING CHANGE: in the commit body? If so, that's very exciting news.

Yep, it does! While I was working on the action I've found that commit-analyzer didn't support this back then, but that was quickly resolved then! I never had any issues so far.

from semantic-pull-requests.

mrchief avatar mrchief commented on June 2, 2024

FWIW, an app works out much better for multiple projects. It's faster than GH actions, doesn't eat up actions runtime quota, easier to configure and so on. There's more you can do with GH actions but doing so again and again across projects becomes tedious after a while.

from semantic-pull-requests.

Related Issues (20)

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.