Giter Site home page Giter Site logo

actionjiracommitvalidate's Introduction

Jira Commit Validate

This Action reads all commits on a PR branch that deviate from a base branch, and checks each commit for a leading ticket number (at the beginning). It then checks to make sure that ticket number exists in a Jira instance you specify to make sure the ticket exists.

You can (and should) block PRs from being merged if this Action fails - you can do so by creating branch policies to protect branches and requiring this Action succeeds in order to merge.

If there is a failure, users should rebase their branch's commit history to contain only valid commits that link real Jira tickets. A great command to do this is: git reset --soft && git commit -a && git rebase master.

There's more information on this Action at Medium here: https://medium.com/@kymidd/lets-do-devops-github-action-check-if-each-commit-contains-valid-jira-ticket-id-63693def70a8

Example call of this action

name: Jira Commit Checker

# Run on push to any branch 
on: [pull_request]

jobs:
  Jira_Commit_Checker:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
        ref: '${{ github.event.pull_request.base.ref }}'

    - name: Prep
      run: |
        # Checkout branch
        git checkout -q ${{ github.event.pull_request.head.ref }}
        
        # Set variables
        BASE_BRANCH=${{ github.event.pull_request.base.ref }}

        # Write BASE_BRANCH to GITHUB_ENV so commit checker can use
        echo "BASE_BRANCH=$BASE_BRANCH" | tee -a $GITHUB_ENV

    - name: Jira Commit Checker
      id: jira_commit_checker
      uses: KyMidd/ActionJiraCommitValidate@v1
      with:
        jira-username: ${{ secrets.JIRA_COMMIT_CHECKER_USERNAME }}
        jira-api-token: ${{ secrets.JIRA_COMMIT_CHECKER_API_TOKEN }}
        JIRA_URL: 'https://foo.atlassian.net'
        BASE_BRANCH: ${{ env.BASE_BRANCH }}

actionjiracommitvalidate's People

Contributors

kymidd avatar lbajsarowicz avatar navarr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.