From 4713fb9241783634ae370eb26a93cb1ab1baca04 Mon Sep 17 00:00:00 2001 From: Luca Bertagna Date: Fri, 29 Sep 2023 11:14:40 -0600 Subject: [PATCH] Add github action to sync fork with upstream --- .../workflows/sync_develop_with_upstream.yml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/sync_develop_with_upstream.yml diff --git a/.github/workflows/sync_develop_with_upstream.yml b/.github/workflows/sync_develop_with_upstream.yml new file mode 100644 index 000000000000..ce668818d7be --- /dev/null +++ b/.github/workflows/sync_develop_with_upstream.yml @@ -0,0 +1,47 @@ +name: Merge Trilinos/trilinos/develop into E3SM-Project/trilinos/develop + +on: + schedule: + - cron: '0 0 * * *' # every day at midnight + workflow_dispatch: # sync on button click + +jobs: + merge-upstream-develop: + + runs-on: ubuntu-latest + + steps: + - name: Show action trigger + run: echo "The job was triggered by a ${{github.event_name}} event." + - name: Get current date + id: date + run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT + - name: Check out the repository + uses: actions/checkout@v4 + with: + show-progress: false + ref: develop + - name: Add upstream repo + run: git remote add upstream https://github.com/trilinos/trilinos + - name: Fetch upstream repo + run: git fetch upstream + - name: Create branch + run: git checkout -b update-develop-${{ steps.date.outputs.DATE }} + - name: Merge upstream branch + run: git merge --ff-only upstream/develop + - name: Push branch + run: git push origin update-develop-${{ steps.date.outputs.DATE }} + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v5 + with: + branch: update-develop-${{ steps.date.outputs.DATE }} + base: develop + title: Merge trilinos/develop into e3sm-project/develop + body: Created by Github action + - name: Merge Pull Request + uses: peter-evans/enable-pull-request-automerge@v3 + with: + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} + - name: Remove remote branch + run: git push origin :update-develop-${{ steps.date.outputs.DATE }}