Skip to content

Can check-enforcer handle pull_request_target, as well as pull_request? #16366

Description

Running into this while wiring up a required check in azure-dev: ext-registry-check.yml (context on why it's pull_request_target: Azure/azure-dev#9155) — it has to run as pull_request_target because the whole point of the check is deciding whether the PR gets to skip core review, so the judging code can't come from the PR itself.

Tried wiring it into check-enforcer via the workflow_run fallback but copilot immediately flagged my change (in my workflow) because, apparently, that specific type gets skipped:

https://github.com/Azure/azure-sdk-actions/blob/1dc8fee9eaf3a8af294f4b299b0ebb3c6745bd2e/main.go#L259

if workflowRun.Event != "pull_request" {
    fmt.Println(fmt.Sprintf("Check enforcer only handles workflow_run events for pull requests. Skipping event for '%s'", workflowRun.Event))
    return nil
}

Since my workflow's workflow_run.event is always "pull_request_target", this branch would bail out (I think, every time).

Is this intentional, or something we could just patch up?

In the interim I was just going to add my stuff to branch protection, which comes with a slight penalty since my workflow now has to run everywhere, even if it just quickly no-ops, but it'll work for our purposes.

(BTW: the spot I'm doing this at is in this PR: Azure/azure-dev#9155)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions