summaryrefslogtreecommitdiffstats
path: root/.github/workflows/sponsors.yml
blob: 79290f8545794071f7dc9941b2a649b2b5578d79 (plain)
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
name: Generate Sponsors README
on:
  push:
    branches:
      - master
  pull_request: # Add this if you want to run checks on PRs as well
    branches:
      - master
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v3
        with:
          ref: master # This ensures the checkout step fetches the master branch

      - name: Switch to master branch
        run: |
          git fetch origin master:refs/remotes/origin/master
          git checkout master

      - name: Generate Sponsors 💖
        uses: JamesIves/github-sponsors-readme-action@v1.2.2
        with:
          token: ${{ secrets.SPONSORS_TOKEN }}
          file: 'README.md'
        if: ${{ github.repository == 'jesseduffield/lazygit' }}

      - name: Commit and push if changed
        run: |-
          git diff
          git config --global user.email "actions@users.noreply.github.com"
          git config --global user.name "README-bot"
          git add README.md
          git commit -m "Updated README.md" || exit 0
          git push origin master # Explicitly push to master branch
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}