Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 7, 2025

Problem

The action could be misconfigured with both check-commits and check-pull-request set to false, which would result in the action not performing any validation. This creates a confusing user experience where the action runs successfully but doesn't actually check anything.

Solution

Added early validation to fail the action if both checks are disabled. The validation:

  • Runs immediately after prerequisite checks, before any processing begins
  • Provides a clear error message indicating at least one check must be enabled
  • Uses GitHub Actions error annotation for better visibility in the workflow UI
# Example configurations that will now fail with a clear error:
with:
  check-commits: false
  check-pull-request: false  # ❌ Error: At least one check must be enabled

Changes

action.yml

  • Added validation check after prerequisite command checks
  • Fails with error message if both check-commits and check-pull-request are false

tests/action.test.sh

  • Added new test suite test_input_validation() with 4 test cases covering all input combinations:
    • Both checks disabled → should be detected as invalid ✅
    • Only check-commits enabled → valid ✅
    • Only check-pull-request enabled → valid ✅
    • Both checks enabled → valid ✅

Testing

All tests passing:

  • ✅ 29 bash tests (25 original + 4 new)
  • ✅ 3 JavaScript tests
  • ✅ Manual verification of validation logic

Fixes #[issue_number]

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
    • Triggering command: 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

This section details on the original issue you should resolve

<issue_title>Validate that commit check or pr check is enabled</issue_title>
<issue_description>If both check-commits and check-pull-request is false, fail the action (at least 1 should be enabled) </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #65

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add validation for commit and PR check configurations Validate that at least one check is enabled (check-commits or check-pull-request) Oct 7, 2025
@Copilot Copilot AI requested a review from joshjohanning October 7, 2025 16:46
Copilot finished work on behalf of joshjohanning October 7, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate that commit check or pr check is enabled

2 participants