Skip to content

Improvement for mgmt-review-agent-workflow #27177

Description

@kazrael2119

Background

The management review workflow exists in both azure-sdk-for-go and azure-sdk-for-js (.github/workflows/mgmt-review.md). The JS version has a much smoother re-run experience than the Go version, driven by three cooperating mechanisms.

How JS supports re-running

1. Two trigger entry points — the JS workflow can be started either by the mgmt-review-needed label or manually via workflow_dispatch (with a PR number item_number input):

on:
  pull_request_target:
    types: [labeled]
    forks: ["*"]
  workflow_dispatch:
    inputs:
      item_number:
        description: PR number to run the review on
        required: true
        type: string
...
if: github.event.label.name == 'mgmt-review-needed' || github.event_name == 'workflow_dispatch'

2. Label state machine (consume-on-start) — on start, a github-script step removes the mgmt-review-needed trigger label and adds mgmt-review-in-progress; on completion it swaps to mgmt-review-added. Because the trigger label is consumed at the start, re-running is simply re-applying mgmt-review-needed (a single action), and the label never lingers ambiguously.

3. Concurrency with cancel-in-progress — a new run for the same PR cancels the previous in-flight run:

concurrency:
  group: "gh-aw-${{ github.workflow }}-${{ ...pr number... }}-${{ github.event.label.name || '' }}"
  cancel-in-progress: true

Current Go behavior (the problem)

The Go workflow has none of the above:

  • Only triggered by the mgmt-review-needed label; no workflow_dispatch manual entry point.
  • No label state machine — the label stays mgmt-review-needed after the run, so there is no visible "in-progress / done" state.
  • To re-run, the docs (Step 2 and Step 5) instruct users to remove and then re-add mgmt-review-needed — a two-step, ambiguous action.
  • No cancel-in-progress, so duplicate/overlapping runs are not cancelled.

Proposed change

Port the JS re-run model to the Go workflow:

  1. Add a workflow_dispatch trigger (with a PR number input) and update the if condition to accept it.
  2. Add a consume-on-start label state machine (mgmt-review-needed → mgmt-review-in-progress → mgmt-review-analyzed), so re-running becomes a single "re-apply mgmt-review-needed" action.
  3. Add concurrency with cancel-in-progress: true to cancel superseded runs.
  4. Update Step 2 / Step 5 wording from "remove and re-add" to "re-apply mgmt-review-needed".

Requires

  • permissions.pull-requests: write (currently read).
  • add-labels / remove-labels in safe-outputs.
  • New repo labels: mgmt-review-in-progress, mgmt-review-analyzed.

Reference

  • JS implementation: azure-sdk-for-js/.github/workflows/mgmt-review.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    MgmtThis issue is related to a management-plane library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions