Skip to content

Commit

Permalink
add upstream fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
0tarof committed Dec 13, 2023
1 parent 8221d27 commit 4b3bb17
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/upstream-fetcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Sync Upstream

env:
# Required, URL to upstream (fork base)
UPSTREAM_URL: "https://github.com/prebid/Prebid.js.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.GITHUB_TOKEN }}
# Optional, defaults to main
UPSTREAM_BRANCH: "master"
# Optional, defaults to UPSTREAM_BRANCH
DOWNSTREAM_BRANCH: "master"
# Optional fetch arguments
FETCH_ARGS: ""
# Optional merge arguments
MERGE_ARGS: ""
# Optional push arguments
PUSH_ARGS: ""
# Optional toggle to spawn time logs (keeps action active)
SPAWN_LOGS: "false" # "true" or "false"

# This runs every day on 1801 UTC
on:
push:
branches:
- DO_NOT_MERGE_aja_staging
schedule:
- cron: '1 18 * * *'
# Allows manual workflow run (must in default branch to work)
workflow_dispatch:

jobs:
fetch-upstream:
runs-on: ubuntu-latest
steps:
- name: Sync master
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: Rebase DO_NOT_MERGE_aja_staging
run: |
git clone https://github.com/ajainc/Prebid.js.git work
cd work
git config user.name ajarobot
git config user.email ajarobot@users.noreply.github.com
git config --local user.password ${{ secrets.GITHUB_TOKEN }}
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/ajainc/Prebid.js.git"
git remote add upstream https://github.com/prebid/Prebid.js.git
git fetch upstream
git remote -v
git switch DO_NOT_MERGE_aja_staging
git push origin
git rebase origin/master
git push -f origin DO_NOT_MERGE_aja_staging
cd ..
rm -rf work

0 comments on commit 4b3bb17

Please sign in to comment.