edk2/.github/workflows/scheduled-maintenance.yml
Michael Kubacki 896930edc9
Some checks failed
CodeQL / Analyze (IA32, CryptoPkg) (push) Has been cancelled
CodeQL / Analyze (IA32, MdeModulePkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, ArmPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, DynamicTablesPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, FatPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, FmpDevicePkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, IntelFsp2Pkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, IntelFsp2WrapperPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, MdePkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, PcAtChipsetPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, PrmPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, SecurityPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, ShellPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, SourceLevelDebugPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, StandaloneMmPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, UefiCpuPkg) (push) Has been cancelled
CodeQL / Analyze (IA32,X64, UnitTestFrameworkPkg) (push) Has been cancelled
CodeQL / Analyze (X64, CryptoPkg) (push) Has been cancelled
CodeQL / Analyze (X64, MdeModulePkg) (push) Has been cancelled
.github: Add issue automation workflows
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>
2024-12-21 01:30:20 +00:00

53 lines
1.6 KiB
YAML

# This workflow performs scheduled maintenance tasks.
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
name: Scheduled Maintenance
on:
schedule:
# * is a special character in YAML so you have to quote this string
# Run every hour - https://crontab.guru/#0_*_*_*_*
- cron: '0 * * * *'
workflow_dispatch:
jobs:
repo_cleanup:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- name: Prune Won't Fix Pull Requests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/pulls | jq -r '.[]' | jq -rc '.html_url,.labels' | \
while read -r html_url ; do
read -r labels
if [[ $labels == *"state:wont-fix"* ]]; then
gh pr close $html_url -c "Closed due to being marked as wont fix" --delete-branch
fi
done
- name: Prune Won't Fix Issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ env.REPOSITORY_NAME }}
run: |
gh api \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/issues | jq -r '.[]' | jq -rc '.html_url,.labels' | \
while read -r html_url ; do
read -r labels
if [[ $labels == *"state:wont-fix"* ]]; then
gh issue close $html_url -c "Closed due to being marked as wont fix" -r "not planned"
fi
done