From b1d58f5b56508c125065aec26874810ab7a02ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Wed, 15 Jul 2020 06:56:36 +0900 Subject: [PATCH] Create merge-autogen.yml --- .github/workflows/merge-autogen.yml | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/merge-autogen.yml diff --git a/.github/workflows/merge-autogen.yml b/.github/workflows/merge-autogen.yml new file mode 100644 index 000000000..687896b73 --- /dev/null +++ b/.github/workflows/merge-autogen.yml @@ -0,0 +1,41 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/github-script@0.9.0 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const { data } = await github.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + }) + + await Promise.all(data + .filter(({ + author_association, + base, + head, + title, + }) => + base.user.login === context.repo.owner && + ['OWNER', 'COLLABORATOR', 'MEMBER'].includes(author_association) && + head.label.startsWith(`${base.user.login}:patch/autogen/`) && + !/WIP/i.test(title))) + .map(({ + number, + }) => + github.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: number, + })))