From 9f8e3abd95b18e028349c72175ddd007df4da5c1 Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Sat, 24 Feb 2024 21:45:41 +0700 Subject: [PATCH] Adds Actions to automatically adds 'B-out-of-date' label --- .github/workflows/main.yml | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c15efd3b..06c73bc6c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,12 +5,41 @@ on: - main concurrency: dev-${{ github.ref }} jobs: - windows: + build-windows: name: Build uses: ./.github/workflows/ci-windows.yml - linux: + build-linux: name: Build uses: ./.github/workflows/ci-linux.yml - mac: + build-mac: name: Build uses: ./.github/workflows/ci-mac.yml + housekeep: + name: Housekeep + runs-on: ubuntu-latest + steps: + - name: Update PRs + run: | + import { Octokit } from 'octokit'; + + const octokit = new Octokit({ auth: '${{ secrets.GITHUB_TOKEN }}' }); + const owner = '${{ github.event.repository.owner.login }}'; + const repo = '${{ github.event.repository.name }}'; + const resp = await octokit.request('GET /repos/{owner}/{repo}/pulls', { + owner, + repo, + base: '${{ github.ref_name }}', + sort: 'updated', + direction: 'desc', + per_page: 100, + }); + + for (const pull of resp.data) { + await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/labels', { + owner, + repo, + issue_number: pull.number, + labels: ['B-out-of-date'], + }); + } + shell: node --input-type=module {0}