mirror of
https://github.com/acidanthera/audk.git
synced 2025-08-31 14:38:09 +02:00
REF: https://github.com/tianocore/edk2/discussions/5926 Adds workflows to manage labels on issues based on issue content. Workflows: - `issue-assignment` - Performs actions when an issue is assigned. - Currently, removed the `state:needs-owner` label. - `issue-triage` - Assigns initial labels to the issue based on data entered when the issue was created. - The policies for applying labels are defined in - `advanced-issue-labeler.yml` - Note: Based on https://github.com/marketplace/actions/advanced-issue-labeler - `scheduled-maintenance` - Runs every hour to perform clean up work need on issues. - Currently, closes issues that have had the `state:wont-fix` label applied. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
# Actions that should occur when a GitHub issue is assigned.
|
|
#
|
|
# Currently this will remove the `state:needs-owner` label when the issue is assigned to an owner.
|
|
#
|
|
# Copyright (c) Microsoft Corporation.
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
name: React to Issue Assignment
|
|
|
|
on:
|
|
issues:
|
|
types: assigned
|
|
|
|
jobs:
|
|
adjust-labels:
|
|
name: Adjust Issue Labels
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Remove Labels
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
# All labels here will be removed if present in the issue
|
|
LABELS_TO_REMOVE=("state:needs-owner")
|
|
|
|
# Gather issue context information
|
|
ISSUE_NUMBER=$(jq --raw-output .issue.number "$GITHUB_EVENT_PATH")
|
|
OWNER=$(jq --raw-output .repository.owner.login "$GITHUB_EVENT_PATH")
|
|
REPO=$(jq --raw-output .repository.name "$GITHUB_EVENT_PATH")
|
|
LABELS=$(curl -s \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/$OWNER/$REPO/issues/$ISSUE_NUMBER/labels | jq -r '.[].name')
|
|
|
|
# Remove labels
|
|
for LABEL in "${LABELS_TO_REMOVE[@]}"; do
|
|
if echo "$LABELS" | grep -q "$LABEL"; then
|
|
curl -X DELETE \
|
|
-s \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/$OWNER/$REPO/issues/$ISSUE_NUMBER/labels/"$LABEL" > /dev/null
|
|
echo "$LABEL removed from issue #$ISSUE_NUMBER"
|
|
else
|
|
echo "$LABEL not found on issue #$ISSUE_NUMBER"
|
|
fi
|
|
done
|