Giter Club home page Giter Club logo

pr-update-work-item-state's Introduction

Update work item state

Update work item state when Pull Request is merged

Update work item state in Azure DevOps ๐Ÿ” when the pull request is merged.

workflow

What Does it do

When a pull request is merged to the target branch, the action will trigger a workflow to update the linked work items state to its next state. For example, if the Work Item's state is in ToDo, the work item's state will change to doing. The action supports both default and custom process templates as well.

Supported Pull Request ๐Ÿ”ƒ States

The action currently supports closed state. Support for other pull request states will be added soon.

Prerequisites

  • Azure DevOps account
  • Azure DevOps PAT
  • GitHub Account
  • GitHub PAT
  • Install the Azure Boards App from GitHub Marketplace

Example Usage

  1. Add the following as GitHub secrets in your repository.

    • Azure DevOps PAT
    • GitHub PAT
    • Azure DevOps Organization
    • Azure DevOps Project
  2. Other Input Parameters

    • closedstate- This Parameter is required for the action to check the workitem state. If the target workitem's state is closed, the action will quit. This is to ensure that a closed work item is not linked to a pull request.

    • gh_repo, gh_repo_owner- To get the latest pull request details

    • pull_number- value of this parameter is obtained from the GitHub event ${{github.event.number}}

WorkFlow Process

  1. Get the Work Item Id

    • With the github repository inputs, a request is sent to the pull request api endpoint to get the complete pull request details
    • From the pull request details the work item id is retrieved
  2. Update the Work Item State

    • With the Work Item and the ADO Project Name, the work item states associated with the Project are pulled.
    • At first, the check will be done whether the work item is in closed state. If not, the workitem state is updated to the next state.

Link the Work Item

The work Item Id must be prefixed with AB and added as AB#[Workitem Id] in the Pull request body. Linking your workitem in your pull request is mandatory, if no workitem is found the action will produce an error.

img

Sample WorkFlow File

name: Update work item state when PR is merged

on:
   pull_request:
    branches: [master]
    types: [closed]

jobs:
  alert:
    runs-on: ubuntu-latest
    name: Test workflow
    steps:       
    - uses: CanarysAutomations/pr-update-work-item-state@master
      env: 
        gh_token : '${{ secrets.GH_TOKEN }}'   
        ado_token: '${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}'
        ado_organization: '${{ secrets.ADO_ORGANIZATION }}'
        ado_project: '${{ secrets.ADO_PROJECT }}'
        closedstate: ''
        gh_repo_owner: ''
        gh_repo: ''
        pull_number: '${{github.event.number}}' 

pr-update-work-item-state's People

Contributors

dependabot[bot] avatar sriplayground avatar vaishnav-canarys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pr-update-work-item-state's Issues

This Action doesn't work anymore

I tried this action to set workitem state to Resolved after the pull request is merged. it doesn't work. it always returns an unknown error.

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.