Skip to content

parsing error in pre-commit file during scanning in CI workflow --- #2

@GangGreenTemperTatum

Description

@GangGreenTemperTatum

hey! thanks for the cool project and apologies for the newb question

i wanted to check this out so added the vanilla workflow, error is here - my workflow is here

name: Workflow Static Analyzer

on:
  workflow_dispatch:
  pull_request:
    branches:
      - main

jobs:
  build:
    name: Analyze Github Workflows
    runs-on: ubuntu-latest
    steps:
      - name: Set Up Ruby
        uses: ruby/setup-ruby@d8d83c3960843afb664e821fed6be52f37da5267 # v1.231.0
        with:
          ruby-version: "3.0"
      - name: Set Up Claws Config
        run: |
          echo ... > /tmp/claws-config.yml
      - name: Set Up Shellcheck
        run: |
          sudo apt-get update
          sudo apt-get install -y shellcheck
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
        with:
          fetch-depth: 0
      - name: Set Up Claws
        run: |
          gem install claws-scan -v 0.7.5
      - name: Analyze Workflows
        run: |
          #!/bin/bash

          # Collect all files in the .github/workflows directory
          workflow_files=$(find .github/workflows -type f)

          # Exit early if there are no workflow files
          if [[ -z "$workflow_files" ]]; then
            echo "No workflow files found in .github/workflows"
            exit 0
          fi

          flags=()

          # Iterate over each workflow file
          while IFS= read -r file; do
            echo "Processing $file"
            flags+=("-t" "$file")
          done <<< "$workflow_files"

          # Run the analyze command with all gathered flags
          analyze -f github -c /tmp/claws-config.yml "${flags[@]}"

error:

Processing .github/workflows/pre-commit.yaml
/opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/gems/3.0.0/gems/claws-scan-0.7.5/lib/claws/cli/yaml_with_lines.rb:111:in `parse': (<unknown>): did not find expected node content while parsing a block node at line 1 column 1 (Psych::SyntaxError)
	from /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/gems/3.0.0/gems/claws-scan-0.7.5/lib/claws/cli/yaml_with_lines.rb:111:in `load'
	from /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/gems/3.0.0/gems/claws-scan-0.7.5/bin/analyze:45:in `<top (required)>'
	from /opt/hostedtoolcache/Ruby/3.0.7/x64/bin/analyze:25:in `load'
	from /opt/hostedtoolcache/Ruby/3.0.7/x64/bin/analyze:25:in `<main>'

assuming it doesn't like my pre-commit workflow file
, i believe here:

---
name: Pre-Commit

i've seen this done multiple times, the workflow itself works fine - do you recommend updating the workflow or any exclusion i can add to the tool, rather than change all my workflow files?

tyia!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions