Skip to content

Commit

Permalink
add sync-merge.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHenryThoreau committed Oct 31, 2024
1 parent ea34503 commit f2a8f9e
Showing 1 changed file with 20 additions and 36 deletions.
56 changes: 20 additions & 36 deletions .github/workflows/sync-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
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/[email protected]
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 "[email protected]"
- name: Sync with Upstream using UPSTREAM_PAT
run: |
git remote add upstream https://x-access-token:${{ secrets.UPSTREAM_PAT }}@github.com/SamR1/FitTrackee.git
git fetch upstream
git merge upstream/master --allow-unrelated-histories # To deal with divergent histories
git push origin master

0 comments on commit f2a8f9e

Please sign in to comment.