Some checks failed
Deploy MkDocs / deploy (push) Has been cancelled
Wrap the `git remote add mirror` command in a conditional check. This ensures the remote is only added if it doesn't already exist, preventing potential errors if the command is executed multiple times or if the remote is somehow already configured in the runner environment.
31 lines
704 B
YAML
31 lines
704 B
YAML
name: Mirror to Gitea
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
mirror:
|
|
runs-on: self-hosted
|
|
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "github-actions"
|
|
git config --global user.email "actions@github.com"
|
|
|
|
- name: Push to mirror
|
|
env:
|
|
MIRROR_PAT: ${{ secrets.MIRROR_PAT }}
|
|
run: |
|
|
if ! git remote | grep -q "^mirror$"; then
|
|
git remote add mirror https://slipstream:${MIRROR_PAT}@git.slipstreamm.dev/slipstream/disagreement.git
|
|
fi
|
|
git push --mirror mirror
|