Giter Site home page Giter Site logo

deepakputhraya / action-branch-name Goto Github PK

View Code? Open in Web Editor NEW
77.0 3.0 37.0 387 KB

Github action to enforce naming convention on branch names

License: MIT License

JavaScript 100.00%
github-actions hacktoberfest pull-requests branching-strategies pullrequest pullrequests

action-branch-name's Introduction

Branch naming rules

GitHub Actions status

Github action to enforce naming convention on branch names

Usage

See action.yml

name: 'Assert Branch Naming Convention'
on: pull_request

jobs:
  branch-naming-rules:
    runs-on: ubuntu-latest
    steps:
      - uses: deepakputhraya/action-branch-name@master
        with:
          regex: '([a-z])+\/([a-z])+' # Regex the branch should match. This example enforces grouping
          allowed_prefixes: 'feature,stable,fix' # All branches should start with the given prefix
          ignore: master,develop # Ignore exactly matching branch names from convention
          min_length: 5 # Min length of the branch name
          max_length: 20 # Max length of the branch name

License

The scripts and documentation in this project are released under the MIT License

action-branch-name's People

Contributors

deepakputhraya avatar dependabot[bot] avatar garciasdos 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

Watchers

 avatar  avatar  avatar

action-branch-name's Issues

Action fails when the event is a workflow_dispatch

Run deepakputhraya/action-branch-name@master
with:
regex: ([a-z])+/([a-zA-Z0-9_.-])+
allowed_prefixes: feature,stable,fix,hotfix
ignore: master,develop,dev,release,main
min_length: 5
max_length: 100
env:
REPOSITORY: ruby-apps-deploy
REPOSITORY_WORKFLOW: ruby-apps-workflows
AWS_DEFAULT_REGION: ***
Event name: workflow_dispatch
Error: Invalid event: workflow_dispatch

Support "create" event?

Would it be possible to support the create event trigger?

Reasoning: The developer should be notified immediately that the new branch is invalid before creating a pull request. I could use the push event, but it feels unnecessary to run the action for every push.

Action doesn't fail when it actually should

I have the following step:

        uses: deepakputhraya/action-branch-name@master
        with:
          regex: '([a-z])+\/([a-z\-\/])+' # Regex the branch should match. This example enforces grouping
          ignore: master,main,dev # Ignore exactly matching branch names from convention

My branch naming convention is that it should consist only of lowercase letters, slashes or minus signs. I.e. feature/my-new-feature would be a valid name, while with feature/myNewFeature it should throw an error.

If I put this regex into regex101.com, and add the test string, it doesn't match the whole string, which would be expected and which should make the action fail (!?)
image

But with exactly this example as a branch name, the action succeeds, also if it shouldn't.

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.