Cleanup missing mods #2972
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Cleanup missing mods | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
schedule: | |
- cron: "24 * * * *" | |
# Sets permissions of the GITHUB_TOKEN to allow push and requesting PRs | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
# Single deploy job since we're just deploying | |
delete-missing-mods: | |
concurrency: | |
group: delete-missing-mods-${{ github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install npm modules | |
run: | | |
(cd source/scripts && npm install) | |
- name: Update the mods from known repos. | |
run: | | |
cd source/scripts | |
npx tsx ./delete-missing-mods.ts 2>&1 | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: Cleanup missing mods | |
commit-message: Cleanup missing mods | |
body: The download links for the mods in this PR are no longer functioning. | |
branch: delete-missing-mods | |
- name: Configure git user | |
if: (false) | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Commit the new files | |
if: (false) | |
run: | | |
git add -A mods | |
( | |
git commit -m "Cleanup missing mods" && | |
( | |
echo "MODS_UPDATED=yes" >> $GITHUB_ENV | |
) | |
) || true | |
- name: Push the updated files | |
if: (false) | |
run: | | |
git pull --rebase | |
git push | |
- name: Trigger deploy | |
if: (env.MODS_UPDATED == 'yes') | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
-d '{"event_type":"trigger_deploy"}' |