Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the action - missing environment variables? #55

Open
mark-hingston opened this issue Nov 26, 2024 · 1 comment
Open

Error running the action - missing environment variables? #55

mark-hingston opened this issue Nov 26, 2024 · 1 comment

Comments

@mark-hingston
Copy link

I have the following job in a workflow:

- name: Merge reports
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          sudo npx ctrf merge reports --output merged-report.json
          sudo npx github-actions-ctrf reports/merged-report.json

When the job executes I see the following output:

npm warn exec The following package was not found and will be installed: ctrf@0.0.10
Merging CTRF reports...
Found file: chromium
Found file: results-74ed3e1d-b50a-4455-8ccb-462ec15619e1.json
Found file: results-bc4367a5-6369-469a-aa87-d33c19e4cd3d.json
Found file: results-e1eb8a74-973c-4c9e-8a28-012b911834a6.json
Found file: results-f24cf585-0ee3-4145-99b8-70617de23c03.json
Skipping non-CTRF file: chromium
Merging report: results-74ed3e1d-b50a-4455-8ccb-462ec15619e1.json
Merging report: results-bc4367a5-6369-469a-aa87-d33c19e4cd3d.json
Merging report: results-e1eb8a74-973c-4c9e-8a28-012b911834a6.json
Merging report: results-f24cf585-0ee3-4145-99b8-70617de23c03.json
CTRF reports merged successfully.
Merged report saved to: /home/runner/work/myrepo/reports/merged-report.json
npm warn exec The following package was not found and will be installed: github-actions-ctrf@0.0.50
/root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:35
                throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
                      ^
Error: Unable to find environment variable for $GITHUB_STEP_SUMMARY. Check if your runtime environment supports job summaries.
    at Summary.<anonymous> (/root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:35:23)
    at Generator.next (<anonymous>)
    at /root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:4:12)
    at Summary.filePath (/root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:29:16)
    at Summary.<anonymous> (/root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:75:41)
    at Generator.next (<anonymous>)
    at /root/.npm/_npx/4b5f679370b5c525/node_modules/@actions/core/lib/summary.js:8:71
    at new Promise (<anonymous>)
Node.js v18.20.5
@Ma11hewThomas
Copy link
Contributor

Hi @mark-hingston,

Your environment may not support job summaries.

In a GitHub Action, the GITHUB_STEP_SUMMARY environment variable is automatically set by the GitHub runner and should be available. However, if your script is running outside of a GitHub Actions runner (e.g., locally or in a custom environment), this variable won’t be set.

If you’re using GitHub Enterprise, I believe job summaries are supported starting from version 3.6.

If neither of these cases applies, consider echoing the value of $GITHUB_STEP_SUMMARY to verify if it’s set, or explicitly set it to an empty value just before running the CTRF reporter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants