GitHub Actions displays the workflow name instead of the commit title when a workflow is triggered by `workflow_run`. This makes it difficult to identify the commit associated with a status workflow run in the UI. Added the `run-name` attribute to all `status-*.yml` files, dynamically setting it to the `display_title` of the original workflow run. This restores visibility of the commit message or PR title in the Actions UI.
28 lines
898 B
YAML
28 lines
898 B
YAML
name: Linux
|
|
run-name: ${{ github.event.workflow_run.display_title }}
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Postsubmit CI"]
|
|
types: [completed]
|
|
|
|
jobs:
|
|
status:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.conclusion != 'skipped' }}
|
|
steps:
|
|
- uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
});
|
|
const job = jobs.find(j => j.name === 'build-linux');
|
|
if (job && job.conclusion !== 'success') {
|
|
core.setFailed(`Linux build failed: ${job.conclusion}`);
|
|
} else if (!job) {
|
|
core.warning(`Job build-linux not found in the workflow run.`);
|
|
}
|