Patchwork checker #2275
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2025 Andrea Cervesato <[email protected]> | |
name: "Patchwork checker" | |
on: | |
push: | |
schedule: | |
- cron: '*/15 * * * 1-5' | |
- cron: '*/45 * * * 6,0' | |
env: | |
PATCHWORK_CI_FILE: patchwork-ci-output.txt | |
jobs: | |
checker: | |
if: ${{ github.repository == 'linux-test-project/ltp' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v1 | |
- name: Verify new patches | |
id: verify | |
run: | | |
./ci/tools/patchwork.sh verify > "$PATCHWORK_CI_FILE" | |
cat "$PATCHWORK_CI_FILE" | |
- name: Run tests | |
if: success() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const output = fs.readFileSync(process.env.PATCHWORK_CI_FILE, 'utf8'); | |
if (output.length === 0) { | |
console.log("'patchwork-ci.sh verify' output is empty"); | |
return; | |
} | |
const lines = output.split('\n'); | |
if (lines.length === 0) { | |
console.log("No new patch-series found"); | |
return; | |
} | |
for (const data of lines) { | |
const [series_id, series_mbox] = data.split('|'); | |
if (series_id.length === 0 || series_mbox.length === 0) { | |
console.log(`Malformed data: ${data}`); | |
continue; | |
} | |
const response = await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.ref, | |
workflow_id: 'ci-docker-build.yml', | |
inputs: { | |
SERIES_ID: series_id, | |
SERIES_MBOX: series_mbox, | |
} | |
}); | |
console.log(response); | |
} |