Files
wehub-resource-sync 3454a55636
cffconvert / validate (push) Has been cancelled
ci-workflow / pre-commit (push) Has been cancelled
ci-workflow / Minimal NLTK Download Test (macos-latest) (push) Has been cancelled
ci-workflow / Minimal NLTK Download Test (ubuntu-latest) (push) Has been cancelled
ci-workflow / Minimal NLTK Download Test (windows-latest) (push) Has been cancelled
ci-workflow / Python 3.10 on macos-latest (push) Has been cancelled
ci-workflow / Python 3.11 on macos-latest (push) Has been cancelled
ci-workflow / Python 3.12 on macos-latest (push) Has been cancelled
ci-workflow / Python 3.13 on macos-latest (push) Has been cancelled
ci-workflow / Python 3.14 on macos-latest (push) Has been cancelled
ci-workflow / Python 3.14t on macos-latest (push) Has been cancelled
ci-workflow / Python 3.10 on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.11 on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.12 on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.13 on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.14 on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.14t on ubuntu-latest (push) Has been cancelled
ci-workflow / Python 3.10 on windows-latest (push) Has been cancelled
ci-workflow / Python 3.11 on windows-latest (push) Has been cancelled
ci-workflow / Python 3.12 on windows-latest (push) Has been cancelled
ci-workflow / Python 3.13 on windows-latest (push) Has been cancelled
ci-workflow / Python 3.14 on windows-latest (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:46:15 +08:00

72 lines
2.3 KiB
YAML

name: Retest PR
on:
issue_comment:
types: [created]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
retest:
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest')
runs-on: ubuntu-latest
permissions:
actions: write
issues: write
pull-requests: read
steps:
- name: Check authorization and trigger phrase
uses: actions/github-script@v9
with:
script: |
const assoc = context.payload.comment.author_association;
if (!['OWNER', 'MEMBER', 'COLLABORATOR'].includes(assoc)) {
core.setFailed('Not authorized (association: ' + assoc + ')');
return;
}
const body = context.payload.comment.body;
if (!body.includes('/retest') &&
!body.includes('[CI: retest]') &&
!body.includes('[ci: retest]')) {
core.setFailed('No recognized retest trigger found.');
}
- name: Get PR head SHA
id: pr
uses: actions/github-script@v9
with:
script: |
const pr = (await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})).data;
core.setOutput('sha', pr.head.sha);
- name: Re-run CI
uses: actions/github-script@v9
with:
script: |
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'ci.yml',
head_sha: '${{ steps.pr.outputs.sha }}',
per_page: 1,
});
if (runs.data.workflow_runs.length === 0) {
core.setFailed('No CI run found for this PR head SHA.');
return;
}
const run = runs.data.workflow_runs[0];
if (run.status === 'completed') {
await github.rest.actions.reRunWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id,
});
} else {
core.info('CI is already running (status: ' + run.status + '). Nothing to re-run.');
}