Skip to content

[NetAppFiles] Release microsoft.net app 2025-03-01 #54245

[NetAppFiles] Release microsoft.net app 2025-03-01

[NetAppFiles] Release microsoft.net app 2025-03-01 #54245

name: ARM Auto SignOff
on:
issue_comment:
types:
- edited
# Must run on pull_request_target instead of pull_request, since the latter cannot trigger on
# labels from bot accounts in fork PRs. pull_request_target is also more similar to the other
# triggers "issue_comment" and "workflow_run" -- they are all privileged# and run in the target
# branch and repo -- which simplifies implementation.
pull_request_target:
types:
# Depends on labels, so must re-evaluate whenever a relevant label is manually added or removed.
- labeled
- unlabeled
workflow_run:
workflows: ["ARM Incremental TypeSpec"]
types: [completed]
# For manual testing
workflow_dispatch:
inputs:
owner:
description: The account owner of the repository. The name is not case sensitive.
required: true
type: string
repo:
description: The name of the repository without the .git extension. The name is not case sensitive.
required: true
type: string
issue_number:
description: The number of the pull request.
required: true
type: string
head_sha:
description: The SHA of the commit.
required: true
type: string
permissions:
actions: read
checks: read
contents: read
issues: read
pull-requests: read
jobs:
arm-auto-signoff:
name: ARM Auto SignOff
# pull_request_target:labeled - filter to only the input and output labels
# issue_comment:edited - filter to only PR comments containing "next steps to merge",
# a signal that checks like "Swagger LintDiff" or "Swagger Avocado" status may have changed
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_run' ||
(github.event_name == 'pull_request_target' &&
(github.event.action == 'labeled' ||
github.event.action == 'unlabeled') &&
(github.event.label.name == 'Approved-Suppression' ||
github.event.label.name == 'ARMAutoSignedOff' ||
github.event.label.name == 'ARMReview' ||
github.event.label.name == 'ARMSignedOff' ||
github.event.label.name == 'NotReadyForARMReview' ||
github.event.label.name == 'SuppressionReviewRequired')) ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, 'next steps to merge'))
runs-on: ubuntu-24.04
steps:
# *** IMPORTANT ***
# For workflows that are triggered by the pull_request_target event, the workflow runs in the
# context of the base of the pull request. You should make sure that you do not check out,
# build, or run untrusted code from the head of the pull request.
- uses: actions/checkout@v4
with:
# Only needs .github folder for automation, not the files in the PR (analyzed in a
# separate workflow).
#
# Uses the .github folder from the PR base branch (pull_request_target trigger),
# or the repo default branch (other triggers).
sparse-checkout: |
.github
# Output:
# {
# labelAction: LabelAction, ("none" for no-op, "add" to add label, and "remove" to remove label)
# issueNumber: number
# }
- id: get-label-action
name: ARM Auto SignOff
uses: actions/github-script@v7
with:
script: |
const { default: getLabelAction } =
await import('${{ github.workspace }}/.github/workflows/src/arm-auto-signoff.js');
return await getLabelAction({ github, context, core });
env:
OWNER: ${{ inputs.owner }}
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
HEAD_SHA: ${{ inputs.head_sha }}
- if: |
fromJson(steps.get-label-action.outputs.result).labelAction == 'add' ||
fromJson(steps.get-label-action.outputs.result).labelAction == 'remove'
name: Upload artifact with results
uses: ./.github/actions/add-label-artifact
with:
name: "ARMAutoSignedOff"
# Convert "add/remove" to "true/false"
value: "${{ fromJson(steps.get-label-action.outputs.result).labelAction == 'add' }}"
- if: |
fromJson(steps.get-label-action.outputs.result).labelAction == 'add' ||
fromJson(steps.get-label-action.outputs.result).labelAction == 'remove'
name: Upload artifact with results
uses: ./.github/actions/add-label-artifact
with:
name: "ARMSignedOff"
# Convert "add/remove" to "true/false"
value: "${{ fromJson(steps.get-label-action.outputs.result).labelAction == 'add' }}"
# Required for consumers to identify the PR associated with this workflow run.
# Output can be trusted, because it was uploaded from a workflow that is trusted,
# because "issue_comment", and "workflow_run" only trigger on workflows in the default branch.
# Consumers should verify the "event_name" before attempting to extract from the artifact name.
- if: |
(github.event_name == 'issue_comment' ||
github.event_name == 'workflow_run') &&
(fromJson(steps.get-label-action.outputs.result).labelAction == 'add' ||
fromJson(steps.get-label-action.outputs.result).labelAction == 'remove')
name: Upload artifact with issue number
uses: ./.github/actions/add-empty-artifact
with:
name: "issue-number"
value: "${{ fromJson(steps.get-label-action.outputs.result).issueNumber }}"