Skip to content

Allow merge_group events when publish_results is false #1647

Description

@thomasqueirozb

The scorecard-action validates that the event is either pull_request or that GITHUB_REF matches the default branch, which prevents it from running in GitHub merge queues where the event is merge_group and the ref is refs/heads/gh-readonly-queue/....

if !o.isPullRequestEvent() &&
!o.isDefaultBranch() {
fmt.Printf("%s not supported with %s event.\n", o.GithubRef, o.GithubEventName)
fmt.Printf("::error ::Only the default branch %s is supported.\n", o.DefaultBranch)

My use case is gating the merge queue on critical scorecard findings, ideally using the same action that publishes results on the default branch. The only workaround today is to install and run the scorecard CLI directly, since GITHUB_* environment variables are read-only in Actions and cannot be overridden.

A minimal fix would be to relax the branch/event validation when publish_results is false. I think other triggers like issue_comment for on-demand runs could also be relaxed in the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions