-
Notifications
You must be signed in to change notification settings - Fork 525
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
Help with infracost comment on commit #1635
Comments
@mpcabral Hi! Thank you for creating the issue! I was able to reproduce this and seems like to be a bug in CLI. The error message is from GitHub's GraphQL API saying that it expects commit as a GitObjectID value, but we send it as a string instead when it fetches existing comments. We tested the functionality thoroughly during implementation and it worked fine. I tried to find any changes in API's changelog, but I can't see anything related to that. The fix looks pretty easy to me though. But it will be available only with the next release. This happens only with the default Please let me know if this helps. :) |
Yes this helped me a lot and I managed to complete my pipeline |
@mpcabral we don't have that option in the # Generate Infracost breakdown
infracost breakdown --plan.json --format=json --out-file=infracost.json
# Run the policy
opa eval --input infracost.json -d infracost-policy.rego --format pretty "data.infracost.deny" | tee opa.out
# If the policy fails, log the details and exit
denyReasons=$(<opa.out)
if [ "$denyReasons" != "[]" ]; then
echo -e "Policy check failed:\n$denyReasons"
exit 1
# If the policy passes, continue and post the comment
else
echo "Policy check passed."
infracost comment github --policy-path infracost-policy.rego --path infracost.json --repo $GITHUB_REPO --commit $GITHUB_COMMIT --github-token $GITHUB_TOKEN
fi |
@mpcabral We just merged the fix to master. It will go live with the next release. It automatically closed this issue too. Please feel free to reopen if you think there is anything unresolved. Thanks again for reporting it! :) BTW, have you had a chance to look at Alistair's comment about the policy? If yes, has it worked for you? |
I am trying to do a CI/CD with infracost
For comment on PR all does normaly
But when i try to comment on a commit i receive a error:
Error: Type mismatch on variable $commitSha and argument oid (String! / GitObjectID)
Command:
infracost comment github --policy-path infracost-policy.rego --path infracost.json --repo mpcabral/infracost-test --commit 27351c2c0bd2aefe3e3a52bbf99f8b8be73e382e --github-token ****
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: