diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index e2edb00..f01e79e 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -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/Fork-Sync-With-Upstream-action@v2.1 - 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 \ No newline at end of file + - 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 }}