Manage work item state when a pull request is closed or opened.
True for success update
-
Add a secret named
ADO_PERSONAL_ACCESS_TOKEN
containing an Azure Personal Access Token with "read & write" permission for Work Items -
Add an optional secret named
GH_PERSONAL_ACCESS_TOKEN
containing a GitHub Personal Access Token with "repo" permissions. See optional information below. -
Install the Azure Boards App from the GitHub Marketplace
-
Add a workflow file which responds to pull request events of
opened, closed
- Set Azure DevOps organization and project details.
- Set specific work item type settings (work item type, new state, active state, closed state)
- Set state that work item must be set:
ado_on_close_state
: State name that the PR will get set too after it is closedado_on_open_state
: State name that the PR will get set too after it is createdOptional Env Variables
github_token
: Used to update the Issue with AB# syntax to link the work item to the issue. This will only work if the project is configured to use the GitHub Azure Boards app.
name: Pull Request close work item
on:
pull_request:
types: [opened, closed]
branches:
- master
jobs:
alert:
runs-on: ubuntu-latest
steps:
- uses: maikmb/github-actions-pr-close-work-item@master
env:
ado_token: '${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}'
github_token: '${{ secrets.GH_TOKEN }}'
ado_organization: 'privatepreview'
ado_project: 'Agile'
ado_wit: 'Task'
ado_on_close_state: 'Done'
ado_on_open_state: 'Code Review'