-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
49646f9
commit 2c88ee6
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This workflow performs scheduled maintenance tasks. | ||
# | ||
# NOTE: This file is automatically synchronized from Mu DevOps. Update the original file there | ||
# instead of the file in this repo. | ||
# | ||
# NOTE: This file uses reusable workflows. Do not make changes to the file that should be made | ||
# in the common/reusable workflows. | ||
# | ||
# - Mu DevOps Repo: https://github.com/microsoft/mu_devops | ||
# - File Sync Settings: https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml | ||
# | ||
# 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 * * * *' | ||
|
||
jobs: | ||
repo_cleanup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get Repository Info | ||
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | ||
|
||
- name: Prune Won't Fix Pull Requests | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPOSITORY: ${{ env.REPOSITORY_NAME }} | ||
run: | | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
/repos/microsoft/${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/microsoft/${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 |