forked from upstream-mirrors/quik
42 lines
1.5 KiB
YAML
42 lines
1.5 KiB
YAML
name: Sync Upstream Quik
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 2 * * 1' # Runs every Monday at 02:00
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
sync:
|
|
name: Sync with Upstream
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: master
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "Gitea Automation"
|
|
git config user.email "actions@gitea.local"
|
|
|
|
- name: Fetch and Merge Upstream
|
|
run: |
|
|
git fetch https://gitea.labus.uk/upstream-mirrors/quik.git master
|
|
# Try to merge upstream master into our master branch.
|
|
# If it fails, the step exits with a non-zero code.
|
|
git merge FETCH_HEAD --no-edit
|
|
git push origin HEAD:master
|
|
|
|
- name: Notify on Failure
|
|
if: failure()
|
|
run: |
|
|
echo "::error::Merge conflict detected or upstream sync failed! Please resolve manually."
|
|
# Automatically create an issue via Gitea API to notify the owner
|
|
curl -X POST "${{ github.api_url }}/repos/${{ github.repository }}/issues" \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"title": "⚠️ Upstream Sync Failed - Merge Conflict", "body": "The scheduled upstream sync with `quik` encountered a merge conflict or error. Please resolve it manually by pulling from upstream and fixing the conflicts."}'
|