-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscheduled-task_update-sponsors.yml
More file actions
68 lines (60 loc) · 2.68 KB
/
scheduled-task_update-sponsors.yml
File metadata and controls
68 lines (60 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Generate Sponsors README
on:
workflow_dispatch:
schedule:
- cron: 30 15 * * 0-6
jobs:
deploy:
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
organization: true
minimum: 4900
maximum: 5100
fallback: 'No bronze sponsors yet. <a href="https://github.com/sponsors/serversideup">Become a sponsor →</a>'
token: ${{ secrets.SPONSORS_README_ACTION_PERSONAL_ACCESS_TOKEN }}
marker: 'bronze'
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="40px" alt="{{{ login }}}" /></a> '
file: 'README.md'
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
organization: true
maximum: 500
fallback: '<p align="center"><a href="https://github.com/sponsors/serversideup"><img src="https://521public.s3.amazonaws.com/serversideup/sponsors/sponsor-empty-state.png" alt="Sponsors"></a></p>'
token: ${{ secrets.SPONSORS_README_ACTION_PERSONAL_ACCESS_TOKEN }}
marker: 'supporters'
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="40px" alt="{{{ login }}}" /></a> '
file: 'README.md'
- name: Create PR and enable auto-merge 🔄
run: |
# Configure git
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Create new branch
git checkout -b update-sponsors-$(date +%Y%m%d-%H%M%S)
# Check if there are any changes
if [[ -n "$(git status --porcelain README.md)" ]]; then
# Commit changes
git add README.md
git commit -m "chore: update sponsors"
# Push the branch BEFORE creating the PR
git push -u origin HEAD
# Now create PR and enable auto-merge
PR_URL=$(gh pr create \
--title "chore: update sponsors" \
--body "Automated PR to update sponsors section in README" \
--base main)
gh pr merge --auto --delete-branch --squash "$PR_URL"
else
echo "No changes to commit. Skipping PR creation."
fi
env:
GH_TOKEN: ${{ secrets.SPONSORS_README_ACTION_PERSONAL_ACCESS_TOKEN }}