From a44359bdf1bf5243d30f40573e0f5f907ced58b5 Mon Sep 17 00:00:00 2001 From: mirrorcult Date: Wed, 6 Oct 2021 21:09:59 -0700 Subject: [PATCH] RSI Diff Bot (#4785) --- .github/workflows/rsi-diff.yml | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/rsi-diff.yml diff --git a/.github/workflows/rsi-diff.yml b/.github/workflows/rsi-diff.yml new file mode 100644 index 0000000000..02ce888f18 --- /dev/null +++ b/.github/workflows/rsi-diff.yml @@ -0,0 +1,67 @@ +name: Diff RSIs + +on: + pull_request: + paths: + - '*.rsi*' + - '*.RSI*' + +jobs: + diff: + name: Diff + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Get changed files + id: files + uses: jitterbit/get-changed-files@v1 + with: + format: 'space-delimited' + + - name: Diff changed RSIs + id: diff + uses: mirrorcult/RSIDiffBot@v1.0 + with: + modified: ${{ steps.files.outputs.modified }} + removed: ${{ steps.files.outputs.removed }} + added: ${{ steps.files.outputs.added }} + basename: ${{ github.event.pull_request.base.repo.full_name }} + basesha: ${{ github.event.pull_request.base.sha }} + headname: ${{ github.event.pull_request.head.repo.full_name }} + headsha: ${{ github.event.pull_request.head.sha }} + + - name: Potentially find comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.number }} + comment-author: 'github-actions[bot]' + body-includes: RSI Diff Bot + + - name: Create comment if it doesn't exist + if: steps.fc.outputs.comment-id == '' + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.number }} + body: | + ${{ steps.diff.outputs.summary-details }} + + - name: Update comment if it exists + if: steps.fc.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + edit-mode: replace + body: | + ${{ steps.diff.outputs.summary-details }} + + - name: Update comment to read that it has been edited + if: steps.fc.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + edit-mode: append + body: | + Edit: diff updated after ${{ github.event.pull_request.head.sha }}