Skip to content

reset-demo-command

reset-demo-command #38

Workflow file for this run

name: reset-demo-command
on:
repository_dispatch:
types: [reset-demo-command]
jobs:
autopep8:
runs-on: ubuntu-latest
steps:
# Checkout the pull request branch
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
fetch-depth: 2
# Determine if the current commit should be reverted
- name: Check commit
id: check
run: |
commit_msg=$(git log --oneline -1)
if [[ $commit_msg =~ "[autopep8-command]" ||
$commit_msg =~ "[black-command]" ]]
then
echo "revert=true" >> $GITHUB_OUTPUT
fi
# Revert the last commit to the PR branch
- name: Revert commit
if: steps.check.outputs.revert == 'true'
run: |
git config --global user.name 'actions-bot'
git config --global user.email '[email protected]'
git revert --no-commit $(git rev-parse HEAD)
git commit -m "[reset-demo-command] revert last commit"
git push
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: hooray