https://infracost.io logo
#help
Title
# help
g

gifted-art-36882

11/29/2022, 7:23 PM
Hi Team, I wanted to ask if anyone has come across the following error (see attached) in the github actions workflow where we are trying to post Infracost comment but ran into "422 validation failed" error, which appears to be stemmed from “commit_id has been locked” error, see screenshot below. I have reached out to github tech support, asking if they have any knowledge of such commit_id being locked issue, unfortunately they were not able to pinpoint the root cause, nor any advice on how to fix it. The issue happens intermittently, and my workaround is to temporarily comment out the Infracost flow (which precedes my terraform workflow), and let terraform workflow run. A few days later I re-enable Infracost flow again and it works like a charm again. I am not sure what the root cause is, just wondering if anyone has run into this particular issue? The details of the update comment command from my workflow is as follows:
Copy code
- name: Post Infracost comment
  run: |
    export INFRACOST_API_KEY=${{ secrets.INFRACOST_API_KEY }}
    infracost comment github --path=/tmp/infracost.json \
                             --repo=$GITHUB_REPOSITORY \
                             --github-token=${{github.token}} \
                             --commit=$GITHUB_SHA \
                             --behavior=update \
                             --policy-path=${TF_ROOT}/infracost-policy.rego
c

crooked-daybreak-55253

11/29/2022, 8:38 PM
Hi @gifted-art-36882, I haven’t seen this issue before, but it seems like there must be some race condition happening. Just a hunch, but could you try changing to
behavior=new
? Since you’re posting the comment to a commit (not a pull request) I think the behavior will be pretty much the same.
g

gifted-art-36882

11/29/2022, 9:02 PM
Thanks Tim! That makes sense. I will make that change as you suggested and will observe in the next few days if I still run into that issue.
2 Views