diff --git a/.github/workflows/rebase-onto-upstream.yml b/.github/workflows/rebase-onto-upstream.yml new file mode 100644 index 00000000000..43383f11fd8 --- /dev/null +++ b/.github/workflows/rebase-onto-upstream.yml @@ -0,0 +1,48 @@ +name: Rebase onto upstream + +on: + workflow_dispatch: + schedule: + - cron: '0 8 * * 5' + +jobs: + push: + runs-on: ubuntu-latest + + strategy: + matrix: + base_ref: + - akirak + # - admin + upstream_branch: + - 'master' + + steps: + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + sparse-checkout: '.' + ref: ${{ matrix.base_ref }} + + - name: Switch the branch + run: | + git switch -C tmp akirak + + - name: Fetch the upstream + run: | + git remote add upstream https://github.com/melpa/melpa.git + git fetch upstream ${{ matrix.upstream_branch }} + + - name: Cherry pick commits + run: | + git config --add user.name 'github-actions[bot]' + git config --add user.email '6270544+github-actions[bot]@users.noreply.github.com' + git rebase -s ort -X theirs upstream/${{ matrix.upstream_branch }} + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.PAT_PUSH }} + branch: '${{ matrix.base_ref }}-tmp' + force: true