Skip to content

[ci] Add check whether PR requires manual RLI updates #18

[ci] Add check whether PR requires manual RLI updates

[ci] Add check whether PR requires manual RLI updates #18

Workflow file for this run

name: Check RLIs
on: [pull_request]
jobs:
check-rlis:
runs-on: ubuntu-latest
steps:
- name: Checkout frc-docs
uses: actions/checkout@v2
with:
repository: wpilibsuite/frc-docs
# Replace with current version
- name: Use PR version
run: |
# Filter source entries, setting the latest version
cat '.github/workflows/inspector.json' \
| jq '.sources |= map(select (.baseUrl | test("wpilibsuite/allwpilib")) | .latestVersion |= "${{ github.event.pull_request.head.sha }}")' \
| tee '.github/workflows/inspector.json'
# Run Inspector
- name: Inspect RLIs
uses: docker://ghcr.io/starlight220/inspector:v1.9
id: inspector
with:
root: ${{ github.workspace }}
env:
INSPECTOR_CONFIG: '.github/workflows/inspector.json'
# Error if RLIs can't be automatically updated
- name: Set exit code
if: ${{ steps.inspector.outputs.needs-manual == 'true' }}
run: exit 1
# ---- Post Report ----
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
if: failure()
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Inspector Report
direction: last
- name: Create comment
if: ${{ failure() && steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
body: ${{ env.REPORT }}
issue-number: ${{ github.event.pull_request.number }}
- name: Update comment
if: ${{ failure() && steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
body: |
### Found RLIs needing manual updates!
<details>
<summary>See the "needs manual updates" section of the report:</summary>
${{ env.REPORT }}
</summary>
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
- name: Update comment
if: ${{ success() && steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
body: All RLIs fixed!
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace