Skip to content

Conversation

@dslatkin
Copy link

@dslatkin dslatkin commented Jun 2, 2023

I was using the example from the README to setup an async script in a workflow and got this error from the API:

Unhandled error: HttpError: No commit found for SHA: undefined

Digging a bit deeper, I discovered that process.env.SHA didn't exist, and should probably be GITHUB_SHA instead. Swapping it out to this worked.

@dslatkin dslatkin requested a review from a team June 2, 2023 02:38
joshmgross
joshmgross previously approved these changes Nov 13, 2023
Copy link
Contributor

@joshmgross joshmgross left a comment

Choose a reason for hiding this comment

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

I believe this example was intending the SHA to be set as an input

      - uses: actions/github-script@v6
        env:
          SHA: '${{env.parentSHA}}'
        with:
          script: |
            const script = require('./path/to/script.js')
            await script({github, context, core})

So process.env.SHA wasn't meant to directly match an existing variable in the context like GITHUB_SHA

@dslatkin
Copy link
Author

That makes sense. I'm not sure I see parentSHA defined anywhere, either. Would it make sense to remove lines 341-342 in that case as well to reduce confusion? Thank you for reviewing!

@dslatkin dslatkin requested a review from a team as a code owner November 28, 2023 20:44
@dslatkin
Copy link
Author

That makes sense. I'm not sure I see parentSHA defined anywhere, either. Would it make sense to remove lines 341-342 in that case as well to reduce confusion? Thank you for reviewing!

Just a heads up, I did just remove these lines in a new commit.

@dslatkin dslatkin closed this by deleting the head repository Jul 18, 2025
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

Successfully merging this pull request may close these issues.

2 participants