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

send-comment PR for commit sha \"HEAD\" not found #880

Closed
Tracked by #606 ...
DavidGOrtega opened this issue Jan 21, 2022 · 9 comments · Fixed by iterative/cml.dev#252
Closed
Tracked by #606 ...

send-comment PR for commit sha \"HEAD\" not found #880

DavidGOrtega opened this issue Jan 21, 2022 · 9 comments · Fixed by iterative/cml.dev#252
Assignees
Labels
cml-comment Subcommand documentation Markdown files p0-critical Max priority (ASAP)

Comments

@DavidGOrtega
Copy link
Contributor

If I repeat the same workflow where the PR was done by cml pr send-comment seems to not found the PR for the given commit sha

{"level":"error","message":"PR for commit sha \"HEAD\" not found","stack":"Error: PR for commit sha \"HEAD\" not found\n    at CML.commentCreate (/usr/local/lib/node_modules/@dvcorg/cml/src/cml.js:148:15)\n    at async Object.exports.handler (/usr/local/lib/node_modules/@dvcorg/cml/bin/cml/send-comment.js:13:15)"}
@DavidGOrtega DavidGOrtega added cml-comment Subcommand bug Something isn't working labels Jan 21, 2022
@judahrand
Copy link

I'm running into the same thing with Github.

cml send-comment --update works in a workflow triggered by a PR but cml send-comment --pr --update does not.

@hlkcrcck
Copy link

hlkcrcck commented Jun 1, 2022

Any updates or workarounds for that issue? It is not possible to send comments to the PR right now on Github

@casperdcl casperdcl added p0-critical Max priority (ASAP) and removed bug Something isn't working labels Jun 2, 2022
@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Jun 3, 2022

Tests

Note
Trigger the following workflows by pushing to a pull request


Contents of .github/workflows/test.yml

on: pull_request
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: gh api /repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls

Output

[]

Contents of .github/workflows/test.yml

on: pull_request
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: git log

Output

commit a7b6e521edaa09bc70a07c7d82473d7666399250 (grafted, HEAD, pull/81/merge)
Author: User <user@domain>
Date:   Thu Jun 2 00:00:00 2022 +0000

    Merge ef08639131b44b2049a9a14c35819709596b85e4 into 8147abb01296e65906cdc28440fc0ccd3a067b69
  • ef08639131b44b2049a9a14c35819709596b85e4 is the last commit in the pull request branch (i.e. the commit that triggered the workflow)
  • 8147abb01296e65906cdc28440fc0ccd3a067b69 is the last commit in the base branch
  • a7b6e521edaa09bc70a07c7d82473d7666399250 is a merge commit invented by GitHub 🙀

@0x2b3bfa0 0x2b3bfa0 assigned 0x2b3bfa0 and unassigned DavidGOrtega Jun 3, 2022
@0x2b3bfa0
Copy link
Member

@0x2b3bfa0
Copy link
Member

🔔 @judahrand & @hlkcrcck

@judahrand
Copy link

🔔 @judahrand & @hlkcrcck

Thank you for looking into this. This seems to be the answer! Probably worth adding this to the documentation somewhere?

@0x2b3bfa0 0x2b3bfa0 added the documentation Markdown files label Jun 6, 2022
@casperdcl
Copy link
Contributor

@0x2b3bfa0
Copy link
Member

Basically what's the answer to actions/checkout#504?

After a cursory search, this is the most plausible answer I have found; nothing official, though:

@0x2b3bfa0
Copy link
Member

Does uses: actions/checkout@v3 with.ref: ${{ github.event.pull_request.head.sha }} work on: [push, pull_request, ...] or does it break other triggers?

Off the top of my head, pull_request.head.sha would be nullish if there is no pull request for the triggering event. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cml-comment Subcommand documentation Markdown files p0-critical Max priority (ASAP)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants