name: PR script test # Builds the ct/ and vm/ scripts a pull request touches on real Proxmox and # Incus hosts and reports the outcome on the PR, as a check run and as one # comment kept up to date. Comment `/test` (optionally a full SHA, app names # and platforms) to build again. # # The workflow itself lives in community-scripts/ci and is shared with # DevScripts/ProxmoxVE; this file only holds the triggers and the queue, and # is identical in both repositories. It runs in this repository's context: # its token, its runners, its PRs. on: issue_comment: types: [created] # The "Ready For Testing" label on a script issue builds that app from the # default branch, as `/test ` in the issue would. issues: types: [labeled] # pull_request_target runs this file from main, never the PR's copy of it, # and does not wait for "approve and run" on forks. pull_request_target: types: [opened, reopened, synchronize, ready_for_review] paths: - "ct/**" - "install/**" - "vm/**" workflow_dispatch: inputs: pr: description: "Pull request number" required: true type: number sha: description: "Pin a commit (full 40-character SHA); empty = the latest, if nothing was pushed since" required: false type: string scripts: description: "Space-separated app names, ct/ or vm/ paths, and platforms (pve, incus, arm); empty = everything the PR touches, everywhere" required: false type: string permissions: {} # One queue per PR. A newer push replaces a run that is still waiting (its # gate would skip anyway: the head moved), but never kills one that is # building: a cancelled job leaves its guest behind until the sweeper. Any # comment and any label starts this workflow; one that is not a /test (or # not the "Ready For Testing" label) gets a group of its own, so it cannot # push a waiting test out of the queue. concurrency: group: >- pr-script-test-${{ ((github.event_name == 'issue_comment' && !startsWith(github.event.comment.body, '/test')) || (github.event_name == 'issues' && github.event.label.name != 'Ready For Testing')) && format('noop-{0}', github.run_id) || github.event.pull_request.number || github.event.issue.number || inputs.pr }} cancel-in-progress: false jobs: pr-script-test: # The most any job in the shared workflow gets; each job there asks for # less (the test job: contents read only). permissions: actions: read checks: write contents: read issues: write pull-requests: write uses: community-scripts/ci/.github/workflows/pr-script-test.yml@main with: screenshots_client_id: ${{ vars.GHAPP_SCREENSHOTS_CLIENT_ID }} # Only the screenshot App, and only the report job uses it: never # `secrets: inherit`, the test jobs run PR code. secrets: screenshots_app_key: ${{ secrets.GHAPP_SCREENSHOTS_PRIVATE_KEY }}