Skip to content

Commit 6686691

Browse files
committed
updating readme, adding github-token input
1 parent b9febfc commit 6686691

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,30 @@ Screenshot of validating the logs and creating pull requests:
1212

1313
<img width="713" alt="image" src="https://user-images.githubusercontent.com/19912012/182616583-70ef5ac4-c669-40df-8fa4-60b15ab1f58f.png">
1414

15+
## Usage
16+
17+
```yml
18+
on:
19+
pull_request:
20+
branches: [ "main" ]
21+
22+
jobs:
23+
pr-commit-message-enforcer-and-linker:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Azure DevOps Commit Validator and Pull Request Linker
28+
uses: joshjohanning/azdo_commit_message_validator@v1
29+
with:
30+
azure-devops-organization: myorg # The name of the Azure DevOps organization
31+
azure-devops-token: ${{ secrets.AZURE_DEVOPS_PAT }} # "Azure DevOps Personal Access Token (needs to be a full PAT)
32+
fail-if-missing-workitem-commit-link: true # Fail the action if a commit in the pull request is missing AB# in the commit message
33+
```
34+
1535
## Setup
1636
1737
1. Create a repository secret titled `AZURE_DEVOPS_PAT`
18-
2. Update the org name in the `action.yml` file under `env`
38+
2. Pass the Azure DevOps organization to the `azure-devops-organization` input parameter
1939

2040
## How this works
2141

action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ inputs:
99
azure-devops-organization:
1010
description: "The name of the Azure DevOps organization"
1111
required: true
12+
github-token:
13+
description: "The GitHub token that has pull request access"
14+
required: true
15+
default: ${{ github.token }}
16+
azure-devops-token:
17+
description: "Azure DevOps Personal Access Token (needs to be a full PAT)"
18+
required: true
1219
fail-if-missing-workitem-commit-link:
1320
description: "Fail the action if a commit in the pull request is missing AB# in the commit message"
1421
required: true
@@ -42,6 +49,6 @@ runs:
4249
echo "Workitem = $WORKITEM"
4350
4451
# make the call to main.js to do the linking
45-
REPO_TOKEN=${{ github.token }} AZURE_DEVOPS_ORG=${{ env.azure_devops_org }} AZURE_DEVOPS_PAT=${{ secrets.AZURE_DEVOPS_PAT }} WORKITEMID=$WORKITEM PULLREQUESTID=${{ github.event.number }} REPO=${{ github.repository }} node main.js
52+
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.js
4653
fi
4754
done

0 commit comments

Comments
 (0)