Skip to content

Update sponsors wall #2

Update sponsors wall

Update sponsors wall #2

Workflow file for this run

name: Update sponsors wall
# Runs every Monday at 00:00 UTC and can be triggered manually.
#
# Required secrets:
# SPONSORKIT_OPENCOLLECTIVE_KEY – OpenCollective API key.
# Create one at https://opencollective.com/applications
# (scoped to the `inversifyjs` collective).
# GH_APP_PRIVATE_KEY – Private key for the GitHub App used to open PRs.
# The `GITHUB_TOKEN` cannot trigger further CI workflows,
# so a GitHub App token is used instead (same pattern as
# `create-bump-pr.yaml`).
#
# Required variables:
# GH_APP_ID – ID of the GitHub App used to generate a PR-creation token.
on:
schedule:
# Every Monday at 00:00 UTC
- cron: '0 0 * * 1'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-sponsors-wall:
name: Update sponsors wall
environment: CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
id: create_token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Generate sponsors wall
run: pnpm sponsorkit
env:
# GitHub Sponsors – token generated by the GitHub App
SPONSORKIT_GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
SPONSORKIT_GITHUB_LOGIN: inversify
# OpenCollective – API key from https://opencollective.com/applications
SPONSORKIT_OPENCOLLECTIVE_KEY: ${{ secrets.SPONSORKIT_OPENCOLLECTIVE_KEY }}
SPONSORKIT_OPENCOLLECTIVE_SLUG: inversifyjs
- name: Commit changes
id: commit
run: |
if [ -z "$(git status --porcelain --untracked-files=all)" ]; then
echo "No changes to sponsors wall"
echo "has_changes=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "has_changes=true" >> $GITHUB_OUTPUT
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B sponsors-wall/main
git add assets/sponsors.svg
git commit -m "chore: update sponsors wall"
- name: Push branch
if: steps.commit.outputs.has_changes == 'true'
run: git push origin sponsors-wall/main --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Open or update PR
if: steps.commit.outputs.has_changes == 'true'
run: |
if [ "$(gh pr list --head sponsors-wall/main --state open --json number --jq 'length')" -eq 0 ]; then
gh pr create \
--base main \
--head sponsors-wall/main \
--title "chore: update sponsors wall" \
--body "Automated weekly sponsors wall update via [sponsorkit](https://github.com/antfu-collective/sponsorkit)."
fi
env:
GH_TOKEN: ${{ steps.create_token.outputs.token }}