Skip to content

JavaScript action returns success for pull request allowed branch, failure otherwise.

License

Notifications You must be signed in to change notification settings

cdcavell/allowed-branch-javascript-action

Repository files navigation

allowed-branch-javascript-action

JavaScript action returns success for pull request allowed branch, failure otherwise.


GitHub license GitHub tag (latest by date) GitHub top language GitHub language count .github/workflows/main-main.yml


Usage

Create a new .github/workflows/allowbranch.yml file:

on:
  pull_request:
    branches:
      - main

jobs:
  allowed_branch_job:
    runs-on: ubuntu-latest
    name: Allowed Branch
    steps:
    # To use this repository's private action,
    # you must check out the repository
    - name: Checkout
    uses: actions/checkout@v2
    - name: Validate action step
      id: allowed-branch
      uses: cdcavell/allowed-branch-javascript-action@v1.1
      with:
        allowed-branch: 'develop'

Set Branch protection rules:

status checks

Note

allowed-branch is a delimited string containting allowed branches. String is comma delimited. Wildcard * is allowed, for example:

feature/* will evaluate true for:

  • feature/v1
  • feature/v1.1
  • feature/v1.0.1

*v1 will evaluate true for:

  • feature/v1
  • hotfix/v1
  • release/v1

About

JavaScript action returns success for pull request allowed branch, failure otherwise.

Resources

License

Stars

Watchers

Forks

Packages

No packages published