From a69c7f0b37b82f6c35aa1d8536f70a5641ca1686 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 5 Jan 2023 15:10:43 +0100 Subject: [PATCH] Workflow to revert any PR title edits --- .github/workflows/pr-title-edited.yml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/pr-title-edited.yml diff --git a/.github/workflows/pr-title-edited.yml b/.github/workflows/pr-title-edited.yml new file mode 100644 index 0000000000..2d94cc017d --- /dev/null +++ b/.github/workflows/pr-title-edited.yml @@ -0,0 +1,30 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Pull request title edited" + +on: + pull_request_target: + types: + - edited + +concurrency: + group: pr-title-edited-${{ github.head_ref }} # will be canceled on subsequent pushes in pull requests + cancel-in-progress: true + +jobs: + revert-title: + name: "Revert title" + runs-on: 'ubuntu-latest' + + steps: + - run: echo "${{ toJSON(github.event.changes) }}" + - uses: octokit/request-action@v2.x + if: github.event.sender.login != 'phpstan-bot' && github.event.changes.title.from != '' + with: + route: PATCH /repos/{owner}/{repo}/pulls/{pull_number} + owner: phpstan + repo: phpstan-src + pull_number: ${{ github.event.number }} + title: ${{ github.event.changes.title.from }} + env: + GITHUB_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}