Skip to content

Ensure all comment-triggered workflows return meaningful completion comments#332

Merged
greenc-FNAL merged 4 commits intomainfrom
copilot/enhance-comment-workflows
Feb 19, 2026
Merged

Ensure all comment-triggered workflows return meaningful completion comments#332
greenc-FNAL merged 4 commits intomainfrom
copilot/enhance-comment-workflows

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Comment-triggered workflows should acknowledge invocation and report completion status. This PR ensures all seven comment-triggered workflows provide consistent acknowledgment and completion feedback.

Changes

1. Added completion comment to cmake-build workflow

  • Added build-complete job to cmake-build.yaml that posts completion status when triggered by @phlexbot build
    • Only runs on issue_comment events (uses always() to run regardless of build outcome)
    • Reports success/failure with emoji indicators and links to workflow run
build-complete:
  needs: [pre-check, build]
  if: >
    always() &&
    github.event_name == 'issue_comment' &&
    needs.pre-check.result == 'success'
  steps:
    - name: Comment on build completion
      uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
      with:
        message: |
          Build and test workflow completed.
          
          **Result:** ${{ needs.build.result == 'success' && '✅ All builds and tests passed.' || '❌ Some builds or tests failed.' }}
          
          See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for detailed results.

2. Fixed markdown-fix workflow to ensure reliable completion comments

  • Switched from using the DavidAnson/markdownlint-cli2-action to directly invoking markdownlint-cli2
  • The third-party action was operating in a different directory context, preventing the handle-fix-commit action from properly detecting file changes via git status
  • Now uses the same pattern as other fix workflows (direct tool invocation with explicit working-directory)
- name: Set up Node.js
  uses: actions/setup-node@42a6b3698c7ed2d0a0c63ba202543c60838be1e7
  with:
    node-version: '20'

- name: Install markdownlint-cli2
  run: npm install -g markdownlint-cli2

- name: Run markdownlint-cli2 fix
  working-directory: ${{ env.local_checkout_path }}
  run: |
    echo "Fixing Markdown format with markdownlint-cli2..."
    markdownlint-cli2 --fix "**/*.md" "!**/CHANGELOG.md" || true

Result

All seven comment-triggered workflows now provide consistent behavior:

  • ✅ Acknowledge invocation with "eyes" emoji (via get-pr-info action)
  • ✅ Post meaningful completion comments with clear status indicators
  • ✅ Use consistent patterns (direct tool invocation with explicit working-directory for fix workflows)

Workflows verified:

  • clang-format-fix - Uses handle-fix-commit for completion comments
  • cmake-format-fix - Uses handle-fix-commit for completion comments
  • jsonnet-format-fix - Uses handle-fix-commit for completion comments
  • python-fix - Uses handle-fix-commit for completion comments
  • markdown-fix - FIXED: Now runs markdownlint-cli2 directly to ensure reliable completion comments
  • clang-tidy-fix - Uses handle-fix-commit for completion comments
  • cmake-build - NEW: Now posts a completion comment with build/test results
Original prompt

This section details on the original issue you should resolve

<issue_title>Ensure all comment-triggered workflows return meaningful results as comments</issue_title>
<issue_description></issue_description>

<agent_instructions>Please examine/enhance all workflows currently invocable by PR comment to ensure that they acknowledge invocation via "eyes" emoji, and give a meaningful comment upon completion. Aim for consistency in message form/detail provided across workflows in similar situations.</agent_instructions>

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

@greenc-FNAL I believe most comment-triggered workflows do this now where appropriate, with the possible exception of `@phlexbot markdown-fix`.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copilot AI changed the title [WIP] Ensure workflows return meaningful results for comment triggers Add completion comment to cmake-build workflow for comment triggers Feb 17, 2026
Copilot AI requested a review from greenc-FNAL February 17, 2026 18:16
@greenc-FNAL
Copy link
Contributor

@copilot Are you sure markdown-fix produces a comment on "no changes required?" I seem to remember running this on a recent PR and getting no comment after "eyes" acknowledgment.

Switch from markdownlint-cli2-action to direct markdownlint-cli2 invocation to ensure consistent behavior with other fix workflows. This resolves an issue where the workflow would acknowledge invocation with "eyes" emoji but not post a completion comment when no changes were needed.

The third-party action may have been operating in a different context that prevented git status from detecting changes properly.

Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot Are you sure markdown-fix produces a comment on "no changes required?" I seem to remember running this on a recent PR and getting no comment after "eyes" acknowledgment.

You're correct. I investigated and found that markdown-fix was using the DavidAnson/markdownlint-cli2-action which may have been operating in a different directory context, preventing the handle-fix-commit action from detecting changes properly via git status.

I've fixed this in commit 9cb3280 by switching to directly invoking markdownlint-cli2 (similar to how python-fix runs ruff), which ensures consistent behavior and reliable completion comments.

Copilot AI changed the title Add completion comment to cmake-build workflow for comment triggers Ensure all comment-triggered workflows return meaningful completion comments Feb 17, 2026
@greenc-FNAL
Copy link
Contributor

@phlexbot format

@github-actions
Copy link
Contributor

No automatic markdownlint fixes were necessary.

@github-actions
Copy link
Contributor

No automatic cmake-format fixes were necessary.

@github-actions
Copy link
Contributor

No automatic jsonnetfmt fixes were necessary.

@github-actions
Copy link
Contributor

No automatic clang-format fixes were necessary.

@greenc-FNAL greenc-FNAL marked this pull request as ready for review February 17, 2026 20:24
Copilot AI review requested due to automatic review settings February 17, 2026 20:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates comment-triggered GitHub Actions workflows to provide clearer user feedback by ensuring markdown-fix reliably produces fix commits/comments and cmake-build posts an explicit completion comment for @phlexbot build.

Changes:

  • Reworked markdown-fix to run markdownlint-cli2 directly in the checked-out PR directory to ensure handle-fix-commit can detect and commit changes reliably.
  • Added a build-complete job to cmake-build to comment the overall build/test outcome back on the PR when triggered via PR comment.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/markdown-fix.yaml Replaces the markdownlint composite action with explicit Node setup + markdownlint-cli2 --fix run in the checkout directory.
.github/workflows/cmake-build.yaml Adds a post-build job that comments success/failure (and links the run) back to the PR for comment-triggered builds.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@greenc-FNAL greenc-FNAL requested a review from knoepfel February 17, 2026 20:30
@greenc-FNAL greenc-FNAL merged commit 7909780 into main Feb 19, 2026
50 checks passed
@knoepfel knoepfel deleted the copilot/enhance-comment-workflows branch February 24, 2026 20:58
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.

Ensure all comment-triggered workflows return meaningful results as comments

4 participants