Skip to content

Update Labels

Update Labels #5111

name: Update Labels
on:
# TODO: If a pull request is manually labeled or unlabeled, get all artifacts associated with PR, and update labels
# pull_request:
# types: [labeled, unlabeled]
# If an upstream workflow if completed, get only the artifacts from that workflow, and update labels
workflow_run:
workflows: ["TypeSpec Requirement", "SDK Suppressions"]
types: [completed]
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
# simulate pull_request trigger
issue_number:
description: The number that identifies the issue.
required: false
type: number
# simulate workflow_run trigger
run_id:
description: The unique identifier of the workflow run.
required: false
type: number
permissions:
contents: read
jobs:
update-labels:
name: Update Labels
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- name: Update Labels
uses: actions/github-script@v7
env:
OWNER: ${{ inputs.owner }}
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
RUN_ID: ${{ inputs.run_id }}
with:
script: |
const { default: updateLabels } =
await import('${{ github.workspace }}/.github/workflows/src/update-labels.js');
await updateLabels({ github, context, core });