Skip to content

Commit c7cf8d1

Browse files
CopilotjoshjohanningCopilot
authored
feat: convert to fully native Node.js action with ES modules and ensuring valid work items (#99)
* Initial plan * Convert to native node action Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com> * Update README and rebuild Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com> * chore: add ESLint configuration and Prettier integration * style: format code for consistency in action.yml and index.js * fix: update coverage badge to reflect current status * chore: delete dist * fix: update import paths to include 'src' directory in tests * Rewrite to clean ES modules with JSDoc and proper imports Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com> * test: enhance main.test.js with comprehensive Azure DevOps functionality tests * chore: remove outdated testing documentation from TESTING.md * feat: enhance commit validation by deduplicating Azure DevOps work item links * test: add comprehensive tests for Azure DevOps Commit Validator * fix(badges): update coverage badge to reflect current coverage of 32.9% * fix(badges): update coverage badge to reflect current coverage of 93.75% * refactor(tests): simplify mock implementations in index.test.js * deps(dev): update @vercel/ncc and eslint to latest versions * chore: bump version to 3.0.0 * chore(deps): update azure-devops-node-api to version 15.1.1 * test: add edge case tests for work item linking and input validation in index.test.js * fix: improve error messages for commit validation and workflow run details * feat: enhance commit validation to collect and report invalid commits with detailed feedback * fix: update workflow run details comment format for clarity * fix: improve error message for invalid commit links in pull request * fix: improve error message for unlinked commits in pull request * fix: enhance error message for unlinked commits with inline reference in pull request * fix: update error message to format work item reference in pull request validation * fix: update workflow run details comment format for clarity * test: add validation for comment updates based on invalid commits in pull requests * fix: update failure comment to success when all commits are linked to work items * fix: update existing failure comment to success when all commits are linked to work items * fix: update existing failure comment to success when all commits are linked to work items * fix(tests): update expected comment body for linked work items * fix: improve logging for linking work items to pull requests * refactor: rename module * feat: add work item validation to Azure DevOps Commit Validator * fix: improve comment formatting for invalid work items in pull requests * feat: enhance work item tracking in pull requests by mapping commits to work items * fix: improve formatting of Azure DevOps work item references in comments * test: add tests for handling multiple invalid work items in commit and PR validation * feat: add HTML comment markers for validation scenarios in Azure DevOps commit validation * fix: return work item to commit map on validation failure in pull request checks * fix: streamline comment formatting for commit validation success messages * feat: enhance validation feedback by combining invalid work items from commits and PRs * fix: update invalid work item comment to success upon validation completion * fix: correct HTML comment formatting for invalid work items and workflow run details * fix: remove extra newline in HTML details for invalid work items and commits * fix: remove extra newlines in workflow run details comments * fix: correct HTML comment formatting for workflow run details * Update src/link-work-item.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: remove unused variable hasCommitFailures in run function * fix: correct error message in link-work-item tests and update coverage badge --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com> Co-authored-by: Josh Johanning <joshjohanning@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7db258d commit c7cf8d1

File tree

16 files changed

+2846
-831
lines changed

16 files changed

+2846
-831
lines changed

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
.nyc_output/
5+
*.min.js
6+
package-lock.json

README.md

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,17 @@ jobs:
5353
5454
### Inputs
5555
56-
| Name | Description | Required | Default |
57-
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | --------------------- |
58-
| `check-pull-request` | Check the pull request body and title for `AB#xxx` | `true` | `true` |
59-
| `check-commits` | Check each commit in the pull request for `AB#xxx` | `true` | `true` |
60-
| `fail-if-missing-workitem-commit-link` | Only if `check-commits=true`, fail the action if a commit in the pull request is missing AB# in every commit message | `false` | `true` |
61-
| `link-commits-to-pull-request` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `true` |
62-
| `azure-devops-organization` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `''` |
63-
| `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` | `''` |
64-
| `github-token` | The GitHub token that has contents-read and pull_request-write access | `true` | `${{ github.token }}` |
65-
| `comment-on-failure` | Comment on the pull request if the action fails | `true` | `true` |
66-
67-
## Setup
68-
69-
### Runner Software Requirements
70-
71-
Required software installed on runner:
72-
73-
- `bash` (tested with `ubuntu-latest` runner)
74-
- [`gh` (GitHub CLI)](https://cli.github.com/)
75-
- [`jq`](https://jqlang.github.io/jq/download/)
76-
- `grep`
77-
- `cut`
56+
| Name | Description | Required | Default |
57+
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------- |
58+
| `check-pull-request` | Check the pull request body and title for `AB#xxx` | `true` | `true` |
59+
| `check-commits` | Check each commit in the pull request for `AB#xxx` | `true` | `true` |
60+
| `fail-if-missing-workitem-commit-link` | Only if `check-commits=true`, fail the action if a commit in the pull request is missing AB# in every commit message | `false` | `true` |
61+
| `link-commits-to-pull-request` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `true` |
62+
| `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` |
63+
| `azure-devops-organization` | Only if `check-commits=true`, link the work items found in commits to the pull request | `false` | `''` |
64+
| `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` | `''` |
65+
| `github-token` | The GitHub token that has contents-read and pull_request-write access | `true` | `${{ github.token }}` |
66+
| `comment-on-failure` | Comment on the pull request if the action fails | `true` | `true` |
7867

7968
## Screenshots
8069

TESTING.md

Lines changed: 0 additions & 248 deletions
This file was deleted.

0 commit comments

Comments
 (0)