From a063b505c6c7cbd771e7b0218da0df6ac80b5d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Rivera?= Date: Wed, 10 Jun 2026 10:26:16 +0200 Subject: [PATCH] CI: weekly PR merge to main from desktop and laptop --- .github/workflows/sync-main.yml | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/sync-main.yml diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml new file mode 100644 index 0000000..d92f97f --- /dev/null +++ b/.github/workflows/sync-main.yml @@ -0,0 +1,58 @@ +name: Sync branches into main + +on: + schedule: + - cron: "0 14 * * 1" + + - cron: "0 14 * * 3" + + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Determine source branch + id: branch + run: | + DOW=$(date -u +%u) + + if [ "$DOW" = "1" ]; then + echo "source=laptop" >> "$GITHUB_OUTPUT" + elif [ "$DOW" = "3" ]; then + echo "source=desktop" >> "$GITHUB_OUTPUT" + else + echo "Not a scheduled sync day" + exit 1 + fi + + - name: Create pull request + id: cpr + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + base: main + branch: ${{ steps.branch.outputs.source }} + title: "Weekly sync: ${{ steps.branch.outputs.source }} → main" + body: | + This pull request was created automatically by GitHub Actions. + + If the branch can be merged cleanly, auto-merge will merge it automatically. + + If there are merge conflicts, this PR will remain open until they are resolved. + draft: false + + - name: Enable auto-merge + if: steps.cpr.outputs.pull-request-number + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr merge \ + ${{ steps.cpr.outputs.pull-request-number }} \ + --auto \ + --merge