Giter Site home page Giter Site logo

joshjohanning / azdo_commit_message_validator Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 1.8 MB

GitHub Action to enforce commits are linked to Azure Boards work items, and link the work item to the pull request

License: MIT License

JavaScript 100.00%
actions azure-devops github

azdo_commit_message_validator's Introduction

Hi there ๐Ÿ‘‹

โšก I am a Senior DevOps Architect with GitHub on the FastTrack team ๐Ÿš€

โšก Previously I was a Senior Cloud Automation Engineer with the Cognizant Microsoft Business Group (formerly 10th Magnitude)

โšก I store my miscellaneous GitHub scripts in github-misc-scripts repo

โšก I use my ghas-demo repository for my GitHub Advanced Security Demo - see PDF here

โšก I have been an avid user of Azure Pipelines and have my pipeline templates consolidated in my pipeline-templates repo

โšก I blog about my DevOps experiences at josh-ops.com

โšก To contact me:

azdo_commit_message_validator's People

Contributors

dependabot[bot] avatar joshjohanning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

azdo_commit_message_validator's Issues

npm install

Forgot to npm install before we commit (otherwise was requiring users to add the npm install correctly ahead of time which is not ideal)

[Question] does this support push events?

@joshjohanning ,

I hope you are doing well.

I was wondering if this GitHub Action supports Push events and if the commit validator follows the conventional commits validation since in the examples the commits only have AB#... without a colon and a commit message. ,e.g

AB#0000 feat: my new feature

Validate that work item exists

In addition to seeing if there is a valid link, ie AB#xyz, validate that it is a valid work item. This will require Azure DevOps PAT.

Improve commit message matching check

We're using a hacky check right now

            if [[ "$COMMIT_MESSAGE" != *"AB"\#""[0-9]""* ]] && [[ "$COMMIT_MESSAGE" != *"ab"\#""[0-9]""* ]]; then

Use grep to make this cleaner?

            if ! echo "$COMMIT_MESSAGE" | grep -i -E -q "AB#[0-9]+"; then

If `link-commits-to-pull-request` is true, verify Azure DevOps Org and PAT are set

Verify that both are not empty

if ${{ inputs.link-commits-to-pull-request }}; then
  # make the call to main.js to do the linking
  # TODO: check to see if org/pat are set
  echo "Attempting to link work item ${WORKITEM} to pull request ${PULL_NUMBER}..."
  REPO_TOKEN=${{ inputs.github-token }} AZURE_DEVOPS_ORG=${{ inputs.azure-devops-organization }} AZURE_DEVOPS_PAT=${{ inputs.azure-devops-token }} WORKITEMID=$WORKITEM PULLREQUESTID=${{ github.event.number }} REPO=${{ github.repository }} node $main
  echo "...PR linked to work item"
fi

Add information on linkage to job summary or `::info`

From the job, make it easier to see what work item(s) were linked to PR

  echo "Pull request linked to work item number: $WORKITEM_NUMBER"
  # TODO: validate work item?
  # TODO: add this as an ::info or to the job summary?

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.