diff --git a/.github/scripts/install-hub.sh b/.github/scripts/install-hub.sh deleted file mode 100755 index 5caf70f4..00000000 --- a/.github/scripts/install-hub.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -eux - -curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s v2.14.2 diff --git a/.github/scripts/sync-with-master.sh b/.github/scripts/sync-with-master.sh deleted file mode 100755 index d8e48786..00000000 --- a/.github/scripts/sync-with-master.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -eux - -# -# This variable must be passed into this script. -# -[[ -n "${BRANCH}" ]] || exit 1 - -# -# We need these config parameters set in order to do the git-merge. -# -git config user.name "${GITHUB_ACTOR}" -git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - -# -# We need the full git repository history in order to do the git-merge. -# -git fetch --unshallow - -# -# In order to open a pull request, we need to push to a remote branch. -# To avoid conflicting with existing remote branches, we use branches -# within the "sync-with-master" namespace. -# -git checkout -b "sync-with-master/${BRANCH}" "origin/${BRANCH}" -git merge -Xtheirs origin/master -git push -f origin "sync-with-master/${BRANCH}" - -# -# Opening a pull request may fail if there already exists a pull request -# for the branch; e.g. if a previous pull request was previously made, -# but not yet merged by the time we run this "sync" script again. Thus, -# rather than causing the automation to report a failure in this case, -# we swallow the error and report success. -# -# Additionally, as along as the git branch was properly updated (via the -# "git push" above), the existing PR will have been updated as well, so -# the "hub" command is unnecessary (hence ignoring the error). -# -git log -1 --format=%B | hub pull-request -F - -b "${BRANCH}" || true diff --git a/.github/workflows/sync-with-master.yml b/.github/workflows/sync-with-master.yml index 5d98d1d1..a6a7a447 100644 --- a/.github/workflows/sync-with-master.yml +++ b/.github/workflows/sync-with-master.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - run: ./.github/scripts/install-hub.sh - - run: ./.github/scripts/sync-with-master.sh + - uses: delphix/actions/sync-with-master@master + with: + branch-to-sync: ${{ matrix.branch }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: ${{ matrix.branch }}