Skip to content

Update binary-ready-veracode-sast-pipeline-scan.yml#96

Open
wsandersvc wants to merge 2 commits intoveracode:mainfrom
wsandersvc:patch-1
Open

Update binary-ready-veracode-sast-pipeline-scan.yml#96
wsandersvc wants to merge 2 commits intoveracode:mainfrom
wsandersvc:patch-1

Conversation

@wsandersvc
Copy link

Resolves the following error:

/home/runner/work/_temp/0a504abb-16de-4fc8-ac79-150ec702cda9.sh: line 16: [: missing `]'
Run success_count=0
  success_count=0
  conclusion="failure"
  # Convert JSON string to a proper format for jq processing
  echo '{
    "pipeline_scan": {
      "result": "failure",
      "outputs": {}
    }
  }' | jq -c 'to_entries[]' | while read -r job; do
    status=$(echo "$job" | jq -r '.value.result')
    echo "$status"
    if [ "$status" = "success" ]; then
      success_count=$((success_count + 1))
      echo '{"status": "completed", "conclusion": "success"}' > payload.txt
    elif [ "$status" = "failure" ]; then
      if [ "$BREAK_BUILD_ON_ERROR" = "false" && "$BREAK_BUILD_ON_POLICY" = "false" ]; then
        echo '{"status": "completed", "conclusion": "success"}' > payload.txt
      else
        echo '{"status": "completed", "conclusion": "failure"}' > payload.txt
      fi
    fi
    curl -X PATCH \
      -H "Authorization: ***" \
      -H "Accept: application/vnd.github+json" \
      https://api.github.com/repos/wsandersvco/verademo-java/check-runs/ \
      -d @"payload.txt"
  done
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    BREAK_BUILD_ON_ERROR: false
    BREAK_BUILD_ON_POLICY: true
/home/runner/work/_temp/0a504abb-16de-4fc8-ac79-150ec702cda9.sh: line 16: [: missing `]'
failure
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   154    0   106  100    48    490    222 --:--:-- --:--:-- --:--:--   716
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest",
  "status": "404"
}

@wsandersvc
Copy link
Author

Issue with the payload file, short answer is the check is not getting updated due to a bash error, so the job completes, but the check run on the commit/PR indicates pending. The code above resolves the "]" error, but not the payload.txt issue.

@wsandersvc
Copy link
Author

wsandersvc commented Mar 9, 2026

Added [register] to needs requirement to permit context access to the required check_run_id variable. This resolves the issue. See output below.

{
  "id": 66322299154,
  "name": "Binary Ready - Veracode Static Code Analysis",
  "node_id": "***",
  "head_sha": "***",
  "external_id": "",
  "url": "https://api.github.com/repos/wsandersvco/verademo-java/check-runs/66322299154",
  "html_url": "https://github.com/wsandersvco/verademo-java/runs/66322299154",
  "details_url": "https://github.com/wsandersvco/veracode/actions/runs/22863068161",
  "status": "completed",
  "conclusion": "failure",
  "started_at": "2026-03-09T16:17:22Z",
  "completed_at": "2026-03-09T16:19:18Z",
  "output": {
    "title": "Veracode Static Code Analysis",
    "summary": "Here's the summary of the scan result.",
    "text": null,
    "annotations_count": 137,
    "annotations_url": "https://api.github.com/repos/wsandersvco/verademo-java/check-runs/66322299154/annotations"
  },
  "check_suite": {
    "id": 59903019309
  },
  "app": {
    "id": 484771,
    "client_id": "***",
    "slug": "veracode-workflow-app",
    "node_id": "***",
    "owner": {
      "login": "veracode",
      "id": 29783584,
      "node_id": "***",
      "avatar_url": "https://avatars.githubusercontent.com/u/29783584?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/veracode",
      "html_url": "https://github.com/veracode",
      "followers_url": "https://api.github.com/users/veracode/followers",
      "following_url": "[https://api.github.com/users/veracode/following{/other_user}](https://api.github.com/users/veracode/following%7B/other_user%7D)",
      "gists_url": "[https://api.github.com/users/veracode/gists{/gist_id}](https://api.github.com/users/veracode/gists%7B/gist_id%7D)",
      "starred_url": "[https://api.github.com/users/veracode/starred{/owner}{/repo}](https://api.github.com/users/veracode/starred%7B/owner%7D%7B/repo%7D)",
      "subscriptions_url": "https://api.github.com/users/veracode/subscriptions",
      "organizations_url": "https://api.github.com/users/veracode/orgs",
      "repos_url": "https://api.github.com/users/veracode/repos",
      "events_url": "[https://api.github.com/users/veracode/events{/privacy}](https://api.github.com/users/veracode/events%7B/privacy%7D)",
      "received_events_url": "https://api.github.com/users/veracode/received_events",
      "type": "Organization",
      "user_view_type": "public",
      "site_admin": false
    },
    "name": "Veracode Workflow App",
    "description": "Now you can automate scans easily at scale by leveraging our Veracode app and use a single workflow to control your entire security program across your organization!  Veracode scans your code with our industry-leading Static + SCA + Container scanning solutions!",
    "external_url": "https://docs.veracode.com/r/GitHub_Workflow_Integration_for_Repo_Scanning",
    "html_url": "https://github.com/apps/veracode-workflow-app",
    "created_at": "2023-11-16T16:52:17Z",
    "updated_at": "2025-10-07T12:46:11Z",
    "permissions": {
      "actions": "read",
      "administration": "write",
      "checks": "write",
      "contents": "write",
      "issues": "write",
      "metadata": "read",
      "pull_requests": "write",
      "security_events": "write"
    },
    "events": [
      "check_run",
      "issues",
      "issue_comment",
      "pull_request",
      "push",
      "workflow_run"
    ]
  },
  "pull_requests": [
    {
      "url": "https://api.github.com/repos/wsandersvco/verademo-java/pulls/387",
      "id": 3374252367,
      "number": 387,
      "head": {
        "ref": "wsandersvc-patch-1",
        "sha": "8fbdf13ae3328854ffe112683c88b90a6577079c",
        "repo": {
          "id": 1148965511,
          "url": "https://api.github.com/repos/wsandersvco/verademo-java",
          "name": "verademo-java"
        }
      },
      "base": {
        "ref": "main",
        "sha": "d6c6e23dc2c18bc499ed30643992e37c0e71d454",
        "repo": {
          "id": 1148965511,
          "url": "https://api.github.com/repos/wsandersvco/verademo-java",
          "name": "verademo-java"
        }
      }
    }
  ]
}

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

Successfully merging this pull request may close these issues.

1 participant