wails/.github/workflows/pr-v3.yml
2025-02-25 04:06:25 +01:00

48 lines
1.7 KiB
YAML

name: PR Checks v3
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
changed_files:
name: Prevent runtime build artifact changes
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: 'true'
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: v3/internal/runtime/desktop/@wailsio/runtime/{dist,docs,types}/**
- name: Get merge base
id: merge-base
if: steps.changed-files.outputs.any_changed == 'true'
env:
BASE_SHA: ${{github.event.pull_request.base.sha}}
HEAD_SHA: ${{github.event.pull_request.head.sha}}
run: |
echo "MERGE_BASE_SHA=$(git merge-base "$BASE_SHA" "$HEAD_SHA")" >> $GITHUB_OUTPUT
- name: Fail and report
uses: actions/github-script@v7
if: steps.changed-files.outputs.any_changed == 'true'
env:
MERGE_BASE_SHA: ${{steps.merge-base.outputs.MERGE_BASE_SHA}}
with:
script: |
process.exitCode = 1
core.error(
'The CI pipeline will rebuild and publish the runtime automatically.\n' +
'Please run the following command (or equivalent) in your local wails repo\n' +
'to revert all build artifact changes, then update the PR:\n\n' +
' cd v3/internal/runtime/desktop/@wailsio/runtime &&\n' +
` git restore -s ${process.env.MERGE_BASE_SHA} -W -S -- dist docs types &&${"\n"}` +
' git commit -m "Revert build artifact changes"',
{ title: "Build artifact changes detected" }
);