From 007ed9ebcb1b45aa44497d4f2ea81d13453b5a34 Mon Sep 17 00:00:00 2001 From: Himadri Sekhar Basu Date: Fri, 29 Apr 2022 10:33:12 +0530 Subject: [PATCH] auto-sync upstream every 6 hours everyday - Automatically sync upstream master branch and all tags every 6 hours everyday --- .github/workflows/auto-sync-upstream.yaml | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/auto-sync-upstream.yaml diff --git a/.github/workflows/auto-sync-upstream.yaml b/.github/workflows/auto-sync-upstream.yaml new file mode 100644 index 00000000..0962a427 --- /dev/null +++ b/.github/workflows/auto-sync-upstream.yaml @@ -0,0 +1,58 @@ +# Automatically fetch and merge upstream master branch and tags + +name: Scheduled Sync Upstream Action +on: + schedule: + # scheduled every 6 hours + - cron: '0 */6 * * *' + + workflow_dispatch: # on button click + inputs: + upstream: + description: 'Upstream repository (eg. linuxmint/cinnamon)' + required: true + default: 'linuxmint/cinnamon-control-center' # set the upstream repo + upstream-branch: + description: 'Upstream branch to merge from. Eg. master' + required: true + default: 'master' # set the upstream branch to merge from + branch: + description: 'Branch to merge to' + required: true + default: 'master' # set the branch to merge to + +jobs: + # This workflow contains a single job called "sync-upstream" + sync-upstream: + runs-on: ubuntu-latest + steps: + # Set default branches when run as scheduled job + - name: Set the branches + env: + DEFAULT_UPSTREAM: 'linuxmint/cinnamon-control-center' # set the upstream repo + DEFAULT_UPSTREAM_BRANCH: 'master' # set the upstream branch to merge from + DEFAULT_BRANCH: 'master' # set the branch to merge to + run: | + echo "upstream=${{ github.event.inputs.upstream || env.DEFAULT_UPSTREAM }}" >> $GITHUB_ENV + echo "upstream-branch=${{ github.event.inputs.upstream-branch || env.DEFAULT_UPSTREAM_BRANCH }}" >> $GITHUB_ENV + echo "branch=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ env.branch }} # set the branch to merge to + # Number of commits to fetch. 0 indicates all history for all branches and tags. + fetch-depth: 0 + + - name: Fetch and Merge Upstream Branch + uses: exions/merge-upstream@v1 + with: + upstream: ${{ env.upstream }} + upstream-branch: ${{ env.upstream-branch }} + branch: ${{ env.branch }} + token: ${{ secrets.TOKEN }} + + - name: Push All Tags + run: | + git push origin --tags + \ No newline at end of file