From 745724afbcd928d3ef74d9199a432de76d0c42a3 Mon Sep 17 00:00:00 2001 From: DavidHenryThoreau Date: Thu, 31 Oct 2024 08:45:23 +0100 Subject: [PATCH] add sync-merge.yaml --- .github/workflows/sync-merge.yaml | 60 +++++++++++++------------------ 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/.github/workflows/sync-merge.yaml b/.github/workflows/sync-merge.yaml index 3080b9946..d2c9400ee 100644 --- a/.github/workflows/sync-merge.yaml +++ b/.github/workflows/sync-merge.yaml @@ -1,44 +1,32 @@ -name: Sync Upstream +name: Sync Fork -env: - # Required, URL to upstream (fork base) - UPSTREAM_URL: "https://github.com/SamR1/FitTrackee.git" - # Required, token to authenticate bot, could use ${{ secrets.GITHUB_TOKEN }} - # Over here, we use a PAT instead to authenticate workflow file changes. - #WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} - WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Optional, defaults to master - UPSTREAM_BRANCH: "master" - # Optional, defaults to UPSTREAM_BRANCH - DOWNSTREAM_BRANCH: "" - # Optional fetch arguments - FETCH_ARGS: "--tags" - # Optional merge arguments - MERGE_ARGS: "" - # Optional push arguments - PUSH_ARGS: "--tags --force" - # Optional toggle to spawn time logs (keeps action active) - SPAWN_LOGS: "false" # "true" or "false" - -# This runs every day on 1801 UTC on: schedule: - - cron: '0 22 * * *' - # Allows manual workflow run (must in default branch to work) + - cron: '0 0 * * *' # This will run the action daily at midnight workflow_dispatch: jobs: - build: + sync: runs-on: ubuntu-latest + steps: - - name: GitHub Sync to Upstream Repository - uses: dabreadman/sync-upstream-repo@v1.3.0 - with: - upstream_repo: ${{ env.UPSTREAM_URL }} - upstream_branch: ${{ env.UPSTREAM_BRANCH }} - downstream_branch: ${{ env.DOWNSTREAM_BRANCH }} - token: ${{ env.WORKFLOW_TOKEN }} - fetch_args: ${{ env.FETCH_ARGS }} - merge_args: ${{ env.MERGE_ARGS }} - push_args: ${{ env.PUSH_ARGS }} - spawn_logs: ${{ env.SPAWN_LOGS }} + - name: Checkout using TOKEN + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure Git + run: | + git config user.name "DavidHenryThoreau" + git config user.email "DavidHenryThoreau@users.noreply.github.com" + + - name: Sync with Upstream using UPSTREAM_PAT + run: | + git remote add upstream https://github.com/SamR1/FitTrackee.git + git fetch --tags upstream + git checkout master + git push origin + git merge upstream/master --allow-unrelated-histories + git commit -m 'Merged upstream' --no-edit + git push --tags origin + git push --force