Skip to content

core.summary.write() fails to display summary when running in a container #2224

@yayamochi

Description

@yayamochi

Describe the bug

Despite calling await core.summary.write(), the Step Summary is not being generated or displayed in the GitHub Actions UI. Even though the logs indicate the script has finished successfully, the summary remains empty.

To Reproduce

jobs:
 tests:
    runs-on: self-hosted
    container:
      image: ubuntu 
    steps:
      - uses: actions/checkout@v4
      - uses: actions/github-script@v7
        with:
          script: |
            const script = require('./scripts/sample.js')
            await script({github, context, core})
            console.log('completed all jobs.')
// sample.js
module.exports = async ({github, context, core}) => {

    let rowsA = ['a', 'b', 'c']

    core.summary.addRaw(`## RowsA`).addEOL()
    for (const row of rowsA) {
        core.summary.addRaw(`### ${row}`, true).addEOL()
    }

    console.log('rowsA add raw')

    let rowsB = ['d', 'e', 'f']

    core.summary.addRaw(`## RowsB`).addEOL()
    for (const row of rowsB) {
        core.summary.addRaw(`### ${row}`, true).addEOL()
    }

    console.log('rowsB add raw')

    console.log("Summary content before write:", core.summary.stringify());
    await core.summary.write({overwrite: true})
    console.log("Summary content after write:", core.summary.stringify());
    console.log('process is completed.')
}

Expected behavior
The content is written at summary.

Additional context
The logs show "process is completed," confirming that await core.summary.write() was reached and executed without throwing any errors. However, the summary tab in the GitHub UI does not appear or shows no content.
After await core.summary.write({overwrite: true}), wait about 20 seconds and it will be written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions