Skip to content

auto-merge-journal.yml: failure comment step never runs after validate exit 1 #150

Description

@Yu-0312

Summary

Unreported workflow bug (no open PR). Field-journal auto-merge validation never posts the failure comment when a PR is blocked.

Reporter note: 先徵求作者方向,我會根據意見再開 PR。

Evidence

.github/workflows/auto-merge-journal.yml

  1. Validate step on whitelist failure:
    • prints ❌ BLOCKED: ...
    • writes valid=false to $GITHUB_OUTPUT
    • exit 1 (job fails)
  2. Comment step:
    - name: Comment on failure
      if: steps.validate.outputs.valid == 'false'
      run: |
        gh pr comment "$PR_NUMBER" --body "..."

GitHub Actions implies success() && <if> unless the expression includes failure() / always(). After exit 1, the comment step is skipped.

Impact

  • BLOCKED field-journal PRs fail CI with no automated explanation on the PR.
  • Only green PRs reach the auto-merge step; authors of rejected PRs see a red check without the intended comment body.

Proposed fix (please confirm)

- name: Comment on failure
  if: failure() && steps.validate.outputs.valid == 'false'

(or if: always() && steps.validate.outputs.valid == 'false' if you want the comment even when valid was unset)

Optional follow-up (your call): also comment when later steps fail after valid=true.

I will open a PR only after you pick failure() vs always().

Scope exclusion

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions