nxtgauge-gitops/.github/workflows/sync-to-forgejo.yml
sync-test f0906d2c67
All checks were successful
sync-to-forgejo / sync (push) Successful in 18s
Add Traceworks Flux image automation
2026-07-05 23:04:54 +05:30

46 lines
1.2 KiB
YAML

name: sync-to-forgejo
on:
push:
branches:
- main
- high-performance
workflow_dispatch:
permissions:
contents: read
concurrency:
group: sync-to-forgejo-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Push to Forgejo
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: |
set -euo pipefail
BRANCH="${GITHUB_REF#refs/heads/}"
REMOTE_URL="https://admin:${FORGEJO_TOKEN}@ci.nxtgauge.com/ashwin/${{ github.event.repository.name }}.git"
git remote add forgejo "$REMOTE_URL" 2>/dev/null || git remote set-url forgejo "$REMOTE_URL"
git fetch forgejo "$BRANCH" || true
if git show-ref --verify --quiet "refs/remotes/forgejo/$BRANCH"; then
git rebase "refs/remotes/forgejo/$BRANCH"
fi
git push forgejo "HEAD:$BRANCH"