Skip to content

Commit dcb9d92

Browse files
committed
refactor: rename add-ab-tag-from-branch to add-work-item-from-branch
1 parent 597a3ee commit dcb9d92

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
| `link-commits-to-pull-request` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `true` |
7474
| `validate-work-item-exists` | Validate that the work item(s) referenced in commits and PR exist in Azure DevOps (requires `azure-devops-token` and `azure-devops-organization`) | `false` | `true` |
7575
| `append-work-item-title` | Append the work item title to `AB#xxx` references in the PR body (e.g. `AB#123` becomes `AB#123 - Fix bug`). Requires `azure-devops-token` and `azure-devops-organization` | `false` | `false` |
76-
| `add-ab-tag-from-branch` | Automatically extract work item ID(s) from the head branch name and add `AB#xxx` to the PR body if not already present | `false` | `false` |
76+
| `add-work-item-from-branch` | Automatically extract work item ID(s) from the head branch name and add `AB#xxx` to the PR body if not already present | `false` | `false` |
7777
| `azure-devops-organization` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `''` |
7878
| `azure-devops-token` | Only required if `link-commits-to-pull-request=true`, Azure DevOps PAT used to link work item to PR (needs to be a `full` PAT) | `false` | `''` |
7979
| `github-token` | The GitHub token that has contents-read and pull_request-write access | `true` | `${{ github.token }}` |

__tests__/index.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('Azure DevOps Commit Validator', () => {
9393
'comment-on-failure': 'true',
9494
'validate-work-item-exists': 'false',
9595
'append-work-item-title': 'false',
96-
'add-ab-tag-from-branch': 'false'
96+
'add-work-item-from-branch': 'false'
9797
};
9898
return defaults[name] || '';
9999
});
@@ -2259,7 +2259,7 @@ describe('Azure DevOps Commit Validator', () => {
22592259
'comment-on-failure': 'false',
22602260
'validate-work-item-exists': 'false',
22612261
'append-work-item-title': 'false',
2262-
'add-ab-tag-from-branch': 'true',
2262+
'add-work-item-from-branch': 'true',
22632263
'github-token': 'github-token',
22642264
'azure-devops-token': '',
22652265
'azure-devops-organization': ''
@@ -2294,7 +2294,7 @@ describe('Azure DevOps Commit Validator', () => {
22942294
'comment-on-failure': 'false',
22952295
'validate-work-item-exists': 'false',
22962296
'append-work-item-title': 'false',
2297-
'add-ab-tag-from-branch': 'true',
2297+
'add-work-item-from-branch': 'true',
22982298
'github-token': 'github-token',
22992299
'azure-devops-token': '',
23002300
'azure-devops-organization': ''
@@ -2326,7 +2326,7 @@ describe('Azure DevOps Commit Validator', () => {
23262326
'comment-on-failure': 'false',
23272327
'validate-work-item-exists': 'false',
23282328
'append-work-item-title': 'false',
2329-
'add-ab-tag-from-branch': 'true',
2329+
'add-work-item-from-branch': 'true',
23302330
'github-token': 'github-token',
23312331
'azure-devops-token': '',
23322332
'azure-devops-organization': ''
@@ -2342,7 +2342,7 @@ describe('Azure DevOps Commit Validator', () => {
23422342
expect(mockOctokit.rest.pulls.update).not.toHaveBeenCalled();
23432343
});
23442344

2345-
it('should not run when add-ab-tag-from-branch is false', async () => {
2345+
it('should not run when add-work-item-from-branch is false', async () => {
23462346
mockContext.payload.pull_request = { number: 42, head: { ref: 'task/12345/make-it-better' } };
23472347

23482348
mockGetInput.mockImplementation(name => {
@@ -2354,7 +2354,7 @@ describe('Azure DevOps Commit Validator', () => {
23542354
'comment-on-failure': 'false',
23552355
'validate-work-item-exists': 'false',
23562356
'append-work-item-title': 'false',
2357-
'add-ab-tag-from-branch': 'false',
2357+
'add-work-item-from-branch': 'false',
23582358
'github-token': 'github-token',
23592359
'azure-devops-token': '',
23602360
'azure-devops-organization': ''
@@ -2382,7 +2382,7 @@ describe('Azure DevOps Commit Validator', () => {
23822382
'comment-on-failure': 'false',
23832383
'validate-work-item-exists': 'false',
23842384
'append-work-item-title': 'false',
2385-
'add-ab-tag-from-branch': 'true',
2385+
'add-work-item-from-branch': 'true',
23862386
'github-token': 'github-token',
23872387
'azure-devops-token': '',
23882388
'azure-devops-organization': ''
@@ -2418,7 +2418,7 @@ describe('Azure DevOps Commit Validator', () => {
24182418
'comment-on-failure': 'false',
24192419
'validate-work-item-exists': 'false',
24202420
'append-work-item-title': 'false',
2421-
'add-ab-tag-from-branch': 'true',
2421+
'add-work-item-from-branch': 'true',
24222422
'github-token': 'github-token',
24232423
'azure-devops-token': '',
24242424
'azure-devops-organization': ''
@@ -2458,7 +2458,7 @@ describe('Azure DevOps Commit Validator', () => {
24582458
'comment-on-failure': 'false',
24592459
'validate-work-item-exists': 'false',
24602460
'append-work-item-title': 'false',
2461-
'add-ab-tag-from-branch': 'true',
2461+
'add-work-item-from-branch': 'true',
24622462
'github-token': 'github-token',
24632463
'azure-devops-token': '',
24642464
'azure-devops-organization': ''

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ inputs:
4848
description: 'Append the work item title to AB#xxx references in the PR body (e.g. AB#123 becomes AB#123 - Fix bug). Requires azure-devops-token and azure-devops-organization to be set.'
4949
required: false
5050
default: 'false'
51-
add-ab-tag-from-branch:
51+
add-work-item-from-branch:
5252
description: 'Automatically extract work item ID(s) from the head branch name and add AB#xxx to the PR body if not already present (e.g. branch task/12345/fix-bug adds AB#12345 to the PR body)'
5353
required: false
5454
default: 'false'

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function run() {
4747
const commentOnFailure = core.getInput('comment-on-failure') === 'true';
4848
const validateWorkItemExistsFlag = core.getInput('validate-work-item-exists') === 'true';
4949
const appendWorkItemTitle = core.getInput('append-work-item-title') === 'true';
50-
const addAbTagFromBranch = core.getInput('add-ab-tag-from-branch') === 'true';
50+
const addWorkItemFromBranch = core.getInput('add-work-item-from-branch') === 'true';
5151

5252
// Warn if an invalid scope value was provided
5353
if (checkPullRequest && pullRequestCheckScopeRaw && !validScopes.includes(pullRequestCheckScopeRaw)) {
@@ -94,7 +94,7 @@ export async function run() {
9494
const octokit = github.getOctokit(githubToken);
9595

9696
// Automatically add AB# tags from branch name if enabled
97-
if (addAbTagFromBranch) {
97+
if (addWorkItemFromBranch) {
9898
await addWorkItemsToPRBody(octokit, context, pullNumber);
9999
}
100100

0 commit comments

Comments
 (0)