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

Fix: Disable summary when it is not available #573

Merged
merged 1 commit into from Jun 27, 2022
Merged

Fix: Disable summary when it is not available #573

merged 1 commit into from Jun 27, 2022

Conversation

philipparndt
Copy link
Contributor

Fix for unsupported step summary on GHE

The workflow summary is currently not available on GitHub Enterprise.

When trying to use the API it will result in the following error:

Error: Unable to find environment variable for $GITHUB_STEP_SUMMARY. Check if your runtime environment supports job summaries.
    at Summary.<anonymous> (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1810:23)
Error: Unable to find environment variable for $GITHUB_STEP_SUMMARY. Check if your runtime environment supports job summaries.
    at Generator.next (<anonymous>)
    at /runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1783:71
    at new Promise (<anonymous>)
    at __webpack_modules__.1327.__awaiter (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1779:12)
    at Summary.filePath (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1804:16)
    at Summary.<anonymous> (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1850:41)
    at Generator.next (<anonymous>)
    at /runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1783:71
    at new Promise (<anonymous>)
    at __webpack_modules__.1327.__awaiter (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1779:12)
    at Summary.write (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:1848:16)
    at generateSummary (/runner/_work/_actions/philipparndt/cy-github-action/disable-summary-on-ghe/dist/index.js:75393:6)
    at tryCatcher (/runner/_work/vehub-frontend/vehub-frontend/vehub/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/runner/_work/vehub-frontend/vehub-frontend/vehub/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/runner/_work/vehub-frontend/vehub-frontend/vehub/node_modules/bluebird/js/release/promise.js:604:18)

This change checks whether or not the feature is available.
It will help to

  • get this great feature as soon as GHE supports the feature
  • and stay up-to-date with the latest cypress-io/github-action version

fixes #570

@CLAassistant
Copy link

CLAassistant commented Jun 20, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@admah admah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philipparndt thank you for submitting this. Could you update the commit message to match semantic-commit convention so that a new build will get triggered once merged?

index.js Outdated
@@ -749,7 +749,16 @@ const runTests = async () => {
.then(onTestsFinished, onTestsError)
}

// Summary is not available for GitHub Enterprise at the moment
const isSummaryEnabled = () => {
return process.env.SUMMARY_ENV_VAR !== undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a link to where this env var is documented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review. The variable was not correct, I'm sorry for that. I should have imported the constant instead.
Can you please have a look at the updated code?

@admah admah merged commit 53cc317 into cypress-io:master Jun 27, 2022
@github-actions
Copy link

🎉 This PR is included in version 4.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Unsupported job summary
3 participants