mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
name: Sync Upstream
|
|
|
|
env:
|
|
UPSTREAM_URL: "https://github.com/binaricat/Netcatty.git"
|
|
UPSTREAM_BRANCH: "main"
|
|
TARGET_BRANCH: "main"
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *' # Run daily at midnight
|
|
workflow_dispatch: # Allow manual trigger
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ env.TARGET_BRANCH }}
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Merge Upstream
|
|
run: |
|
|
echo "Adding upstream remote..."
|
|
git remote add upstream ${{ env.UPSTREAM_URL }}
|
|
git fetch upstream ${{ env.UPSTREAM_BRANCH }}
|
|
|
|
echo "Merging upstream/${{ env.UPSTREAM_BRANCH }} into ${{ env.TARGET_BRANCH }}..."
|
|
# This will fail if there are conflicts, which is the desired behavior (notify user via failure)
|
|
git merge upstream/${{ env.UPSTREAM_BRANCH }} --no-edit
|
|
|
|
echo "Pushing changes..."
|
|
git push origin ${{ env.TARGET_BRANCH }}
|