Remove contributors with deleted accounts #76
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
name: Remove contributors with deleted accounts | |
on: | |
schedule: | |
# https://crontab.guru/#0_0_*_*_1 | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
inputs: | |
skipPR: | |
description: Push results straight to master instead of opening a PR | |
required: false | |
default: 'false' | |
permissions: | |
contents: read | |
jobs: | |
ghostbust: | |
permissions: | |
contents: write # for Git to git push | |
pull-requests: write # for peter-evans/create-pull-request to create a PR | |
runs-on: ubuntu-latest | |
if: github.repository == 'DefinitelyTyped/DefinitelyTyped' | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: '20' | |
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 | |
with: | |
run_install: | | |
- args: [--filter, ., --filter, '{./scripts}...'] | |
- run: node ./scripts/ghostbuster.js > ${{ runner.temp }}/comment.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- if: ${{ inputs.skipPR == 'true' }} | |
run: | | |
if [ -n "`git status -s`" ]; then | |
git config --global user.email "typescriptbot@microsoft.com" | |
git config --global user.name "TypeScript Bot" | |
git commit -am "Remove contributors with deleted accounts #no-publishing-comment" | |
# Script can take a bit to run; with such an active repo there's a good chance | |
# someone has merged a PR in that time. | |
git pull --rebase | |
git push | |
fi | |
- if: ${{ inputs.skipPR != 'true' }} | |
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6.0.2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Remove contributors with deleted accounts #no-publishing-comment' | |
committer: 'TypeScript Bot <typescriptbot@microsoft.com>' | |
author: 'TypeScript Bot <typescriptbot@microsoft.com>' | |
branch: 'bust-ghosts' | |
branch-suffix: short-commit-hash | |
delete-branch: true | |
title: Remove contributors with deleted accounts | |
body-path: ${{ runner.temp }}/comment.md |