Skip to content

Commit 072aea1

Browse files
Improve work item linkage messages based on code review feedback
Co-authored-by: joshjohanning <[email protected]>
1 parent b047bed commit 072aea1

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

TESTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Test Summary
44

5-
**Bash Tests: 32/32 Passing**
5+
**Bash Tests: 33/33 Passing**
66
**JavaScript Tests: 3/3 Passing**
77

88
## Overview
99

1010
This project has two types of tests:
1111

12-
1. **Bash Script Tests** - Tests for the core action logic in `action.yml` ✅ (32 tests passing)
12+
1. **Bash Script Tests** - Tests for the core action logic in `action.yml` ✅ (33 tests passing)
1313
2. **JavaScript Tests** - Tests for the work item linking logic in `main.js` ✅ (3 tests passing)
1414

1515
## Bash Script Tests
@@ -51,7 +51,7 @@ The bash script tests focus on the core validation and automation logic.
5151
- Finding existing PR comments by content
5252
- Handling non-existent comments
5353

54-
-**GitHub Actions Annotations** (7 tests)
54+
-**GitHub Actions Annotations** (8 tests)
5555
- Testing notice annotation format for work items
5656
- Testing job summary format for commits and PRs
5757
- Verifying work item information is properly displayed
@@ -69,8 +69,8 @@ npm run test:bash
6969
### Bash Test Results
7070

7171
```text
72-
Total Tests: 32
73-
Passed: 32
72+
Total Tests: 33
73+
Passed: 33
7474
All tests passed!
7575
```
7676

@@ -121,10 +121,10 @@ npm test
121121

122122
This will run:
123123

124-
1. Bash tests (32 passing)
124+
1. Bash tests (33 passing)
125125
2. JavaScript tests (3 passing)
126126

127-
**Total: 35 tests passing**
127+
**Total: 36 tests passing**
128128

129129
## Test Files
130130

__tests__/action.test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,12 @@ test_github_annotations() {
286286
# Test summary format
287287
PULL_NUMBER="42"
288288
SHORT_COMMIT_SHA="abc123d"
289-
SUMMARY_COMMIT="- Commit ${SHORT_COMMIT_SHA} linked to work item AB#${WORKITEM_NUMBER}"
289+
SUMMARY_COMMIT="- Work item AB#${WORKITEM_NUMBER} (from commit ${SHORT_COMMIT_SHA}) linked to pull request #${PULL_NUMBER}"
290290
SUMMARY_PR="- Pull request #${PULL_NUMBER} linked to work item AB#${WORKITEM_NUMBER}"
291291

292-
assert_contains "$SUMMARY_COMMIT" "Commit abc123d" "Summary should include short commit SHA"
293-
assert_contains "$SUMMARY_COMMIT" "AB#12345" "Summary should include work item"
292+
assert_contains "$SUMMARY_COMMIT" "Work item AB#12345" "Summary should include work item"
293+
assert_contains "$SUMMARY_COMMIT" "from commit abc123d" "Summary should include commit SHA"
294+
assert_contains "$SUMMARY_COMMIT" "pull request #42" "Summary should include PR number"
294295
assert_contains "$SUMMARY_PR" "Pull request #42" "Summary should include PR number"
295296
assert_contains "$SUMMARY_PR" "AB#12345" "Summary should include work item"
296297
}

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ runs:
9090
echo "Attempting to link work item ${WORKITEM} to pull request ${PULL_NUMBER}..."
9191
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
9292
echo "...PR linked to work item"
93-
echo "::notice title=Work Item Linked::Commit linked to work item AB#${WORKITEM}"
94-
echo "- Commit ${SHORT_COMMIT_SHA} linked to work item AB#${WORKITEM}" >> $GITHUB_STEP_SUMMARY
93+
echo "::notice title=Work Item Linked::Work item AB#${WORKITEM} (from commit ${SHORT_COMMIT_SHA}) linked to pull request #${PULL_NUMBER}"
94+
echo "- Work item AB#${WORKITEM} (from commit ${SHORT_COMMIT_SHA}) linked to pull request #${PULL_NUMBER}" >> $GITHUB_STEP_SUMMARY
9595
fi
9696
fi
9797
done

0 commit comments

Comments
 (0)