Verify Azure DevOps Org and PAT are set when link-commits-to-pull-request is true #92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When
link-commits-to-pull-request
is set totrue
, the action attempts to link work items to pull requests using Azure DevOps APIs. However, if the requiredazure-devops-organization
orazure-devops-token
inputs are not provided, the action would proceed to call the Node.js script and fail with a cryptic error later in the process.The code had a TODO comment indicating this validation was needed:
# TODO: check to see if org/pat are set
Solution
Added validation checks before attempting to link work items that verify both Azure DevOps configuration values are set. The validation:
azure-devops-organization
, thenazure-devops-token
Example
If a user configures the action with
link-commits-to-pull-request: true
but forgets to set the organization:Before: The action would fail later with a cryptic error about Azure DevOps API calls failing
After: The action fails immediately with:
Testing
Added comprehensive test coverage in
__tests__/action.test.sh
:All 29 bash tests and 3 JavaScript tests pass with no regressions.
Fixes the TODO comment and improves user experience by providing clear, actionable error messages early in the workflow execution.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dev.azure.com
node /home/REDACTED/work/azdo_commit_message_validator/azdo_commit_message_validator/node_modules/.bin/jest
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.