ci(generate): check for USERSTYLES_TOKEN
In order to bypass repository rulesets, the repository must be cloned with a PAT. This commit adds 2 steps to clone the repository, one where the PAT exists and one where it does not. This should allow the action to succeed on main and on forked repositories.
This commit is contained in:
parent
8cd5bdba2f
commit
b6383c8a4a
14
.github/workflows/generate.yml
vendored
14
.github/workflows/generate.yml
vendored
@ -8,6 +8,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DENO_DIR: deno_cache
|
DENO_DIR: deno_cache
|
||||||
|
HAS_USERSTYLES_TOKEN: ${{ secrets.USERSTYLES_TOKEN != '' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-health-files:
|
generate-health-files:
|
||||||
@ -19,7 +20,16 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Check Out Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
if: ${{ env.HAS_USERSTYLES_TOKEN }}
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.USERSTYLES_TOKEN }}
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Check Out Repository (Fork)
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
if: "!${{ env.HAS_USERSTYLES_TOKEN }}"
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
@ -40,7 +50,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Push Changes
|
- name: Push Changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' }}
|
if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' && env.HAS_USERSTYLES_TOKEN }}
|
||||||
with:
|
with:
|
||||||
commit_message: "chore: generate health files"
|
commit_message: "chore: generate health files"
|
||||||
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
|
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user