Skip to content

rebase-command

rebase-command #1914

Workflow file for this run

name: Rebase
on:
repository_dispatch:
types:
- rebase-command
jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Automatic rebase
uses: giorio94/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
- name: Retrieve rebase commit hash
run: echo "rebasedcommit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: rebase-commit-extraction
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_TOKEN }}
event-type: test-command
client-payload: |
{
"pull_request": {
"head": {
"sha": "${{ steps.rebase-commit-extraction.outputs.rebasedcommit }}"
}
},
"github": {
"payload": {
"repository": {
"full_name": "${{ github.repository }}"
},
"issue": {
"number": "${{ github.event.client_payload.github.payload.issue.number }}"
}
}
},
"slash_command": {
"command": "test"
}
}
if: github.event.client_payload.slash_command.args.named.test == 'true'
- name: Set the reaction for the comment
id: rebase_reaction
run: |
[[ ${{ job.status }} == 'success' ]] && \
echo "reaction=hooray" >> $GITHUB_OUTPUT || \
echo "reaction=confused" >> $GITHUB_OUTPUT
if: always()
- name: Report status as reaction
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CI_TOKEN }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: '${{ steps.rebase_reaction.outputs.reaction }}'
if: always()