I developed a new Github Action to create an Azure DevOps Bug Work Item for failing Github Workflow actions.
For Azure DevOps there are already some Extensions that create a Bug when a release is failing, but I wanted to have something simular in Github Workflows.
With the Github Action Azure DevOps Bug Work Item you can create an Azure DevOps Bug Work Item for failed Github Workflow Actions.
Screenshot Github Workflow with failed Action
Screenshot Bug created in Azure DevOps Backlog
As your team identifies code defects or bugs, they can add them to the backlog and track them similar to requirements. Or, they can schedule them to be fixed within a sprint along with other tasks.
More information can be found here
name: Error
on: [push]
jobs:
error:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Throw error in PowerShell script
run: |
throw 'something failed';
- name: The job has failed
uses: stefanstranger/azuredevops-bug-action@v1
if: failure()
with:
OrganizationName: "stefanstranger"
PAT: "PAT"
ProjectName: "Contoso"
AreaPath: "Contoso\\Automation"
IterationPath: "Contoso"
GithubToken: "GithubToken"
WorkflowFileName: "error.yml"
env:
PAT: $
GithubToken: $
Input | Description |
---|---|
OrganizationName | Azure DevOps Organization name |
PAT | Github Secret Name for PAT stored as Github environment variable |
ProjectName | Azure DevOps Project name |
AreaPath | Azure DevOps Area Path for the Bug Work Items |
IterationPath | Azure DevOps Iteration Path for the Bug Work Item |
GithubToken | Github Secret Name for Github Token stored as Github environment variable |
WorkflowFileName | Github Workflow file name |
For creating the Azure DevOps Bug Work Item we need to create an Azure DevOps Personal Access Token.
More information about creating an Azure DevOps Personal Access token can be found here
The minimal scope authorization for Work Items is Read, write & manage.
Add the PAT output as a secret (let’s say with the name PAT
) in the GitHub repository.
This Github Action uses the Github REST API to retrieve detailed information about the failed Github Workflow Run.
Create a Github Personal Access Token via the Github Developer Settings.
Your Github Token needs the following permissions:
Add the Github Token a secret (let’s say with the name githubtoken
) in the GitHub repository.
Hope you enjoy this new Github Action!
References