@@ -20,11 +20,15 @@ permissions:
2020 contents : read
2121 issues : write
2222
23+ # Serialize reconciliation per stream so two runs for the same stream can never
24+ # race and double-create issues.
25+ concurrency :
26+ group : reconcile-${{ inputs.nsolidStream }}
27+ cancel-in-progress : false
28+
2329jobs :
2430 check-vulns :
2531 runs-on : ubuntu-latest
26- outputs :
27- matrix : ${{ steps.set_matrix.outputs.matrix }}
2832 steps :
2933 - name : Setup Python 3.11
3034 uses : actions/setup-python@v5
4448 python3 --version
4549 - name : Checkout current repository
4650 uses : actions/checkout@v4
47- - name : Debug directory structure
48- run : |
49- echo "Current directory:"
50- pwd
51- echo "Directory contents:"
52- ls -la
53- echo "dep_checker directory exists:"
54- ls -la dep_checker/ || echo "dep_checker directory not found"
5551 - name : Installing pre-reqs
5652 working-directory : ./dep_checker
5753 run : pip install -r requirements.txt
@@ -63,58 +59,22 @@ jobs:
6359 ref : ${{ inputs.nsolidStream }}
6460 - name : Run the check
6561 working-directory : ./dep_checker
62+ # Write clean JSON to result.json (diagnostics go to stderr). A non-zero exit
63+ # just means "vulnerabilities were found" — it must not skip reconciliation.
6664 run : |
67- (
68- set -o pipefail
69- python3 main.py --json-output --include-npm --npm-timeout 600 --gh-token ${{ secrets.GITHUB_TOKEN }} --nvd-key=${{ secrets.NVD_API_KEY }} ../nsolid ${{ inputs.nsolidStream }} 2>&1 | tee result.log
70- )
71- cat result.log
72- - name : build matrix
73- id : set_matrix
74- if : ${{ failure() }}
65+ python3 main.py --scan-file result.json --include-npm --npm-timeout 600 \
66+ --gh-token ${{ secrets.GITHUB_TOKEN }} --nvd-key=${{ secrets.NVD_API_KEY }} \
67+ ../nsolid ${{ inputs.nsolidStream }} || true
68+ echo "Scan result:"
69+ cat result.json
70+ - name : Reconcile issues
71+ if : ${{ always() }}
7572 working-directory : ./dep_checker
76- run : |
77- # Extract vulnerabilities JSON from the log
78- vulnerabilities_json=$(grep -o '{.*}' result.log | tail -1)
79- echo "Raw vulnerabilities JSON: $vulnerabilities_json"
80-
81- # Use the matrix formatter to build the complete matrix with labels
82- matrix=$(python3 ../.github/workflows/format_matrix.py "$vulnerabilities_json" "${{ inputs.nsolidStream }}")
83- echo "Formatted matrix: $matrix"
84- echo "matrix=$matrix" >> $GITHUB_OUTPUT
85-
86- create-issues :
87- needs : check-vulns
88- if : ${{ always() }}
89- runs-on : ubuntu-latest
90- strategy :
91- matrix : ${{ fromJson(needs.check-vulns.outputs.matrix) }}
92- max-parallel : 1
93- steps :
94- - uses : actions/checkout@v4
95- - name : Debug matrix data
96- run : |
97- echo "Matrix vulnerability data:"
98- echo "ID: ${{ matrix.vulnerabilities.id }}"
99- echo "Dependency: ${{ matrix.vulnerabilities.dependency }}"
100- echo "Source: ${{ matrix.vulnerabilities.source }}"
101- echo "Labels: ${{ join(matrix.vulnerabilities.labels, ', ') }}"
102- echo "ISSUE_LABELS: ${{ join(matrix.vulnerabilities.labels, ',') }}"
103-
104- - name : Create or update GitHub issue
10573 env :
106- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107- GITHUB_REPOSITORY : ${{ github.repository }}
108- VULN_ID : ${{ matrix.vulnerabilities.id }}
109- VULN_URL : ${{ matrix.vulnerabilities.url }}
110- VULN_DEP_NAME : ${{ matrix.vulnerabilities.dependency }}
111- VULN_DEP_VERSION : ${{ matrix.vulnerabilities.version }}
112- VULN_SOURCE : ${{ matrix.vulnerabilities.source }}
113- VULN_TITLE : ${{ matrix.vulnerabilities.title }}
114- VULN_MAIN_DEP_NAME : ${{ matrix.vulnerabilities.main_dep_name }}
115- VULN_MAIN_DEP_PATH : ${{ matrix.vulnerabilities.main_dep_path }}
116- NODEJS_STREAM : ${{ inputs.nsolidStream }}
117- ACTION_URL : " https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
118- LABELS : ${{ join(matrix.vulnerabilities.labels, ',') }}
74+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+ GH_REPO : ${{ github.repository }}
11976 run : |
120- .github/workflows/create_issue.sh
77+ python3 reconcile_issues.py \
78+ --stream "${{ inputs.nsolidStream }}" \
79+ --scan-file result.json \
80+ --action-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
0 commit comments