44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
name: Sync upstream
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 16 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Sync main from upstream (Surgical)
|
|
run: |
|
|
git remote add upstream https://github.com/nap0o/2fauth-worker.git || true
|
|
git fetch upstream
|
|
git checkout main
|
|
|
|
if ! git merge upstream/main --no-edit --no-commit; then
|
|
git checkout --ours .github/workflows
|
|
git add .github/workflows
|
|
git commit -m "chore: sync upstream (handled conflicts)"
|
|
else
|
|
if git diff --name-only HEAD | grep -q ".github/workflows"; then
|
|
git checkout HEAD -- .github/workflows
|
|
fi
|
|
git commit -m "chore: sync upstream (code and assets only)" || echo "no changes"
|
|
fi
|
|
|
|
- name: Push synced main
|
|
run: |
|
|
git push origin main |