Skip to content

Commit e37035a

Browse files
fix(a2ml): use reusable workflows from root instead of duplicates
- codeql.yml: Replace inline implementation with call to ../codeql-reusable.yml - governance.yml: Use relative path ../governance-reusable.yml instead of external SHA pin - hypatia-scan.yml: Replace custom implementation with call to ../hypatia-scan-reusable.yml - instant-sync.yml: Upgrade to match root version with concurrency and proper secrets handling - mirror.yml: Replace inline multi-forge implementation with call to ../mirror-reusable.yml - scorecard.yml: Replace inline implementation with call to ../scorecard-reusable.yml - scorecard-enforcer.yml: Removed (consolidated into reusable workflow pattern) - secret-scanner.yml: Replace inline implementation with call to ../secret-scanner-reusable.yml This reduces duplication and ensures a2ml uses the same, maintained reusable workflows as the rest of the estate, eliminating drift and structural inconsistencies. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1 parent dedbf14 commit e37035a

8 files changed

Lines changed: 60 additions & 484 deletions

File tree

a2ml/.github/workflows/codeql.yml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,17 @@ on:
77
pull_request:
88
branches: [main, master]
99
schedule:
10-
- cron: '0 6 * * 1'
10+
- cron: '0 6 1 * *'
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: false
1215

13-
permissions: read-all
16+
permissions:
17+
contents: read
1418

1519
jobs:
16-
analyze:
17-
runs-on: ubuntu-latest
18-
timeout-minutes: 30
19-
permissions:
20-
contents: read
21-
security-events: write
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
include:
26-
- language: javascript-typescript
27-
build-mode: none
28-
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
32-
33-
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.28.1
35-
with:
36-
languages: ${{ matrix.language }}
37-
build-mode: ${{ matrix.build-mode }}
38-
39-
- name: Perform CodeQL Analysis
40-
uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.28.1
41-
with:
42-
category: "/language:${{ matrix.language }}"
20+
analyze-js:
21+
uses: ../.github/workflows/codeql-reusable.yml
22+
with:
23+
language: javascript-typescript

a2ml/.github/workflows/governance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ permissions:
2323

2424
jobs:
2525
governance:
26-
uses: hyperpolymath/standards/.github/workflows/governance-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
26+
uses: ../.github/workflows/governance-reusable.yml
Lines changed: 9 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,21 @@
11
# SPDX-License-Identifier: MPL-2.0
2-
# Hypatia Neurosymbolic CI/CD Security Scan
32
name: Hypatia Security Scan
43

54
on:
65
push:
7-
branches: [ main, master, develop ]
6+
branches: [main, master, develop]
87
pull_request:
9-
branches: [ main, master ]
8+
branches: [main, master]
109
schedule:
11-
- cron: '0 0 * * 0' # Weekly on Sunday
10+
- cron: '0 0 * * 0'
1211
workflow_dispatch:
1312

14-
permissions: read-all
13+
permissions:
14+
actions: read
15+
contents: read
16+
security-events: write
1517

1618
jobs:
1719
scan:
18-
name: Hypatia Neurosymbolic Analysis
19-
runs-on: ubuntu-latest
20-
timeout-minutes: 20
21-
22-
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25-
with:
26-
fetch-depth: 0 # Full history for better pattern analysis
27-
28-
- name: Setup Elixir for Hypatia scanner
29-
uses: erlef/setup-beam@2f0cc07b4b9bea248ae098aba9e1a8a1de5ec24c # v1.18.2
30-
with:
31-
elixir-version: '1.18'
32-
otp-version: '27'
33-
34-
- name: Clone Hypatia
35-
run: |
36-
if [ ! -d "$HOME/hypatia" ]; then
37-
git clone https://github.com/hyperpolymath/hypatia.git "$HOME/hypatia"
38-
fi
39-
40-
- name: Build Hypatia scanner (if needed)
41-
working-directory: ${{ env.HOME }}/hypatia
42-
run: |
43-
if [ ! -f hypatia-v2 ]; then
44-
echo "Building hypatia-v2 scanner..."
45-
cd scanner
46-
mix deps.get
47-
mix escript.build
48-
mv hypatia ../hypatia-v2
49-
fi
50-
51-
- name: Run Hypatia scan
52-
id: scan
53-
run: |
54-
echo "Scanning repository: ${{ github.repository }}"
55-
56-
# Run scanner
57-
HYPATIA_FORMAT=json "$HOME/hypatia/hypatia-cli.sh" scan . > hypatia-findings.json
58-
59-
# Count findings
60-
FINDING_COUNT=$(jq '. | length' hypatia-findings.json 2>/dev/null || echo 0)
61-
echo "findings_count=$FINDING_COUNT" >> $GITHUB_OUTPUT
62-
63-
# Extract severity counts
64-
CRITICAL=$(jq '[.[] | select(.severity == "critical")] | length' hypatia-findings.json)
65-
HIGH=$(jq '[.[] | select(.severity == "high")] | length' hypatia-findings.json)
66-
MEDIUM=$(jq '[.[] | select(.severity == "medium")] | length' hypatia-findings.json)
67-
68-
echo "critical=$CRITICAL" >> $GITHUB_OUTPUT
69-
echo "high=$HIGH" >> $GITHUB_OUTPUT
70-
echo "medium=$MEDIUM" >> $GITHUB_OUTPUT
71-
72-
echo "## Hypatia Scan Results" >> $GITHUB_STEP_SUMMARY
73-
echo "- Total findings: $FINDING_COUNT" >> $GITHUB_STEP_SUMMARY
74-
echo "- Critical: $CRITICAL" >> $GITHUB_STEP_SUMMARY
75-
echo "- High: $HIGH" >> $GITHUB_STEP_SUMMARY
76-
echo "- Medium: $MEDIUM" >> $GITHUB_STEP_SUMMARY
77-
78-
- name: Upload findings artifact
79-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
80-
with:
81-
name: hypatia-findings
82-
path: hypatia-findings.json
83-
retention-days: 90
84-
85-
- name: Submit findings to gitbot-fleet (Phase 2)
86-
if: steps.scan.outputs.findings_count > 0
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
GITHUB_REPOSITORY: ${{ github.repository }}
90-
GITHUB_SHA: ${{ github.sha }}
91-
run: |
92-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
93-
94-
# Clone gitbot-fleet to temp directory
95-
FLEET_DIR="/tmp/gitbot-fleet-$$"
96-
git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
97-
98-
# Run submission script
99-
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json
100-
101-
# Cleanup
102-
rm -rf "$FLEET_DIR"
103-
104-
echo "✅ Finding submission complete"
105-
106-
- name: Check for critical issues
107-
if: steps.scan.outputs.critical > 0
108-
run: |
109-
echo "⚠️ Critical security issues found!"
110-
echo "Review hypatia-findings.json for details"
111-
# Don't fail the build yet - just warn
112-
# exit 1
113-
114-
- name: Generate scan report
115-
run: |
116-
cat << EOF > hypatia-report.md
117-
# Hypatia Security Scan Report
118-
119-
**Repository:** ${{ github.repository }}
120-
**Scan Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")
121-
**Commit:** ${{ github.sha }}
122-
123-
## Summary
124-
125-
| Severity | Count |
126-
|----------|-------|
127-
| Critical | ${{ steps.scan.outputs.critical }} |
128-
| High | ${{ steps.scan.outputs.high }} |
129-
| Medium | ${{ steps.scan.outputs.medium }} |
130-
| **Total**| ${{ steps.scan.outputs.findings_count }} |
131-
132-
## Next Steps
133-
134-
1. Review findings in the artifact: hypatia-findings.json
135-
2. Auto-fixable issues will be addressed by robot-repo-automaton (Phase 3)
136-
3. Manual review required for complex issues
137-
138-
## Learning
139-
140-
These findings feed Hypatia's learning engine to improve future rules.
141-
142-
---
143-
*Powered by [Hypatia](https://github.com/hyperpolymath/hypatia) - Neurosymbolic CI/CD Intelligence*
144-
EOF
145-
146-
cat hypatia-report.md >> $GITHUB_STEP_SUMMARY
147-
148-
- name: Comment on PR with findings
149-
if: github.event_name == 'pull_request' && steps.scan.outputs.findings_count > 0
150-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
151-
with:
152-
script: |
153-
const fs = require('fs');
154-
const findings = JSON.parse(fs.readFileSync('hypatia-findings.json', 'utf8'));
155-
156-
const critical = findings.filter(f => f.severity === 'critical').length;
157-
const high = findings.filter(f => f.severity === 'high').length;
158-
159-
let comment = `## 🔍 Hypatia Security Scan\n\n`;
160-
comment += `**Findings:** ${findings.length} issues detected\n\n`;
161-
comment += `| Severity | Count |\n|----------|-------|\n`;
162-
comment += `| 🔴 Critical | ${critical} |\n`;
163-
comment += `| 🟠 High | ${high} |\n`;
164-
comment += `| 🟡 Medium | ${findings.length - critical - high} |\n\n`;
165-
166-
if (critical > 0) {
167-
comment += `⚠️ **Action Required:** Critical security issues found!\n\n`;
168-
}
169-
170-
comment += `<details><summary>View findings</summary>\n\n`;
171-
comment += `\`\`\`json\n${JSON.stringify(findings.slice(0, 10), null, 2)}\n\`\`\`\n`;
172-
comment += `</details>\n\n`;
173-
comment += `*Powered by Hypatia Neurosymbolic CI/CD Intelligence*`;
174-
175-
github.rest.issues.createComment({
176-
owner: context.repo.owner,
177-
repo: context.repo.repo,
178-
issue_number: context.issue.number,
179-
body: comment
180-
});
20+
uses: ../.github/workflows/hypatia-scan-reusable.yml
21+
secrets: inherit

a2ml/.github/workflows/instant-sync.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@ on:
88
release:
99
types: [published]
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
permissions:
16+
actions: read
1217
contents: read
1318

1419
jobs:
1520
dispatch:
21+
timeout-minutes: 10
1622
runs-on: ubuntu-latest
17-
timeout-minutes: 20
23+
env:
24+
FARM_DISPATCH_TOKEN: ${{ secrets.FARM_DISPATCH_TOKEN }}
1825
steps:
1926
- name: Trigger Propagation
27+
if: ${{ env.FARM_DISPATCH_TOKEN != '' }}
2028
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v3
2129
with:
2230
token: ${{ secrets.FARM_DISPATCH_TOKEN }}
@@ -30,5 +38,14 @@ jobs:
3038
"forges": ""
3139
}
3240
41+
- name: Skipped (FARM_DISPATCH_TOKEN not configured)
42+
if: ${{ env.FARM_DISPATCH_TOKEN == '' }}
43+
env:
44+
REPO_NAME: ${{ github.event.repository.name }}
45+
run: |
46+
echo "::notice::FARM_DISPATCH_TOKEN secret not configured on ${REPO_NAME}; skipping cross-repo dispatch."
47+
3348
- name: Confirm
34-
run: echo "::notice::Propagation triggered for ${{ github.event.repository.name }}"
49+
env:
50+
REPO_NAME: ${{ github.event.repository.name }}
51+
run: echo "::notice::Propagation triggered for ${REPO_NAME}"

0 commit comments

Comments
 (0)