rebase-command #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rebase-command | |
on: | |
repository_dispatch: | |
types: [rebase-command] | |
jobs: | |
rebase: | |
if: github.event.client_payload.pull_request.rebaseable == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout pull request | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.client_payload.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: Rebase | |
run: | | |
git config --global user.name 'gitops-bot' | |
git config --global user.email '52609384+gitops-bot@users.noreply.github.com' | |
git remote add base https://x-access-token:${{ secrets.PA_TOKEN }}@github.com/${{ github.event.client_payload.pull_request.base.repo.full_name }}.git | |
git fetch base ${{ github.event.client_payload.pull_request.base.ref }} | |
git rebase base/${{ github.event.client_payload.pull_request.base.ref }} | |
git push --force-with-lease | |
- name: Update comment | |
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b #v3.0.1 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
repository: ${{ github.event.client_payload.github.payload.repository.full_name }} | |
comment-id: ${{ github.event.client_payload.github.payload.comment.id }} | |
body: | | |
>Pull request successfully rebased | |
reactions: hooray | |
notRebaseable: | |
if: github.event.client_payload.pull_request.rebaseable != true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update comment | |
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b #v3.0.1 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
repository: ${{ github.event.client_payload.github.payload.repository.full_name }} | |
comment-id: ${{ github.event.client_payload.github.payload.comment.id }} | |
body: | | |
>Pull request is not rebaseable | |
reactions: hooray | |