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

$COMMITS_URL issues #11

Open
fharper opened this issue Jul 23, 2024 · 7 comments
Open

$COMMITS_URL issues #11

fharper opened this issue Jul 23, 2024 · 7 comments

Comments

@fharper
Copy link

fharper commented Jul 23, 2024

In two out of six repositories where we are using this action, I'm having an error on all pull requests:

jq: error (at <stdin>:5): Cannot index string with string "commit"

It seems like in some cases, github.event.pull_request will be empty (see the discussion at https://github.com/orgs/community/discussions/25220). There are some workarounds in the thread.

Unfortunately, it happened only in some repositories I cannot share here as they contain private code, so I cannot show you a case where this issue is happening. I would gladly help debug, provide information about the workflow, and test any fix you may have.

I may try to fix the action myself once I have the time, but we are in the middle of a big release, so time is scarce for now.

@florisvdg
Copy link
Contributor

Would help if you could share some YAML snippets of the workflow you're calling this action from. For example: what event does it run on, pull_request, pull_request_target, something else?

And for those repos where you're seeing the error, does it always happen there or only in certain PRs or certain circumstances?

@florisvdg
Copy link
Contributor

Also, I'm seeing now that not every curl command in the action is configured to fail fast, so it might be that GitHub is returning a 4XX or 5XX status code for some reason. I've put up a branch to fail sooner print the error message, which you can use in your workflow YAML like this:

uses: 1Password/check-signed-commits-action@519a1dbdded076a15e1d628896a3b6beb3a9ed0b

@fharper
Copy link
Author

fharper commented Aug 21, 2024

I totally missed your comment, sorry.

Here is how I use it https://github.com/kubefirst/docs/blob/main/.github/workflows/check-signed.yml . It's not the one that is failing, but it's the same exact code in the same exact kind of repository (I cannot share the other one).

I'll test the branch, and report back, thanks

@fharper
Copy link
Author

fharper commented Aug 21, 2024

So your branch branch is giving me more information. The curl command is returning a 403 on the https://api.github.com/repos/MY-ORG/MY-REPO/pulls/14/commits call. The repository is private, but I thought the default token would do the job, no?

@florisvdg
Copy link
Contributor

Does it work if you change on: [pull_request, pull_request_target] to on: pull_request_target?

@fharper
Copy link
Author

fharper commented Sep 3, 2024

I got this error even with on: pull_request_target only

CleanShot 2024-09-03 at 10 57 04@2x

@fharper
Copy link
Author

fharper commented Sep 17, 2024

So it seems like the problem is only happening with private repositories. We made public the ones where I had this issue, and now it's back to working properly.

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