Skip to content

Commit

Permalink
t3
Browse files Browse the repository at this point in the history
  • Loading branch information
stooit committed Oct 3, 2024
1 parent 3dad47b commit f00e53b
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
on:
schedule:
- cron: '0 * * * *'
name: Sync Upstream

workflow_dispatch: # click the button
env:
# Required, URL to upstream (fork base)
UPSTREAM_URL: "https://github.com/ipverse/asn-info.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 }}
# Optional, defaults to main
UPSTREAM_BRANCH: "master"
# Optional, defaults to UPSTREAM_BRANCH
DOWNSTREAM_BRANCH: ""
# 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:
schedule:
- cron: '1 18 * * *'
# Allows manual workflow run (must in default branch to work)
workflow_dispatch:

jobs:
sync_with_upstream:
build:
runs-on: ubuntu-latest
name: Sync master with upstream latest

steps:
# Step 1: run a standard checkout action, provided by github
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master

# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch
- name: Pull (Fast-Forward) upstream changes
id: sync
uses: aormsby/[email protected]
with:
upstream_repository: ipverse/asn-info
upstream_branch: master
target_branch: master
git_pull_args: --merge

# Step 3: Display a message if 'sync' step had new commits (simple test)
- name: Check for new commits
if: steps.sync.outputs.has_new_commits
run: echo "There were new commits."

# Step 4: Print a helpful timestamp for your records (not required, just nice)
- name: Timestamp
run: date
- 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 }}

0 comments on commit f00e53b

Please sign in to comment.