title: How to capture a curl http status code in a GitHub Action to determine success/failure?
body: <p>I am very new to GitHub Actions so bear with me...I am trying to create a GitHub Action, with one of the steps being a curl call to a GitHub API. I want to catch the HTTP status code, for that curl call, to determine if the Action actually failed or not. Right now, because the curl completes successfully, it always returns as a successful run, even if the curl response may have a bad status code (e.g. 405, 404, 403, etc).</p>
  <p>Here is my curl call:</p>
  <pre><code>- name: Squash And Merge After Approval of PR
          run: |
            curl --request PUT \
            --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
            --header 'content-type: application/json' \
            --url https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr_num }}/merge \
            --data '{
             &quot;merge_method&quot;: &quot;squash&quot;,
             &quot;commit_title&quot;: &quot;Squash and Merge for Pull Request ${{ github.event.inputs.pr_num }}&quot;,
             &quot;commit_message&quot;: &quot;expected sha value = ${{ github.event.inputs.pr_head_sha }}&quot;,
             &quot;sha&quot;:&quot;${{ github.event.inputs.pr_head_sha }}&quot;
             }'
  </code></pre>
  <p>I'm thinking I have to wrap my curl command somehow to maybe output the response in a variable, or? But I don't know how to capture the curl response, parse it, and check the status code to determine if curl was successful or not.</p>
  <p>TIA.</p>
  <p>PS: This is a manually run Action, therefore I am supplying the &quot;sha&quot; and &quot;pr number&quot; from an input form when the Action is run.</p>