Skip to content

Commit 5b9ab0b

Browse files
committed
Fix all pre-commit issues: YAML syntax and formatting
- Simplified Python script to single-line to avoid YAML parsing issues - Fixed trailing whitespace in workflow files - All pre-commit checks now passing locally Signed-off-by: Dan Gil <[email protected]>
1 parent c6e029f commit 5b9ab0b

File tree

4 files changed

+1053
-777
lines changed

4 files changed

+1053
-777
lines changed

.github/workflows/dependency-extraction-nightly.yml

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,82 +28,64 @@ permissions:
2828
jobs:
2929
extract-dependencies:
3030
runs-on: ubuntu-latest
31-
31+
3232
steps:
3333
- name: Checkout repository
3434
uses: actions/checkout@v4
3535
with:
3636
fetch-depth: 0 # Need history for comparison
37-
37+
3838
- name: Set up Python
3939
uses: actions/setup-python@v5
4040
with:
4141
python-version: '3.12'
42-
42+
4343
- name: Install dependencies
4444
run: pip install pyyaml
45-
45+
4646
- name: Run dependency extraction
4747
run: |
4848
TIMESTAMP=$(date +%Y%m%d_%H%M)
49-
49+
5050
# Generate timestamped version (for artifacts)
5151
python3 .github/workflows/extract_dependency_versions.py \
5252
--output .github/reports/dependency_versions_${TIMESTAMP}.csv \
5353
--report-unversioned \
5454
--report-removed .github/reports/removed_dependencies.json
55-
55+
5656
# Copy to latest version (for repo tracking)
5757
mkdir -p .github/reports
5858
cp .github/reports/dependency_versions_${TIMESTAMP}.csv .github/reports/dependency_versions_latest.csv
59-
59+
6060
# Copy unversioned report if it exists
6161
if [ -f "unversioned_dependencies_${TIMESTAMP}.csv" ]; then
6262
cp unversioned_dependencies_${TIMESTAMP}.csv .github/reports/unversioned_dependencies_latest.csv
6363
fi
64-
64+
6565
echo "TIMESTAMP=${TIMESTAMP}" >> $GITHUB_ENV
66-
66+
6767
- name: Check for changes
6868
id: check_changes
6969
run: |
7070
if [[ -n $(git status --porcelain .github/reports/*_latest.csv) ]]; then
7171
echo "has_changes=true" >> $GITHUB_OUTPUT
72-
72+
7373
# Count dependencies by status from latest
7474
new_count=$(grep -c ",New," .github/reports/dependency_versions_latest.csv 2>/dev/null || echo "0")
7575
changed_count=$(grep -c ",Changed," .github/reports/dependency_versions_latest.csv 2>/dev/null || echo "0")
7676
unchanged_count=$(grep -c ",Unchanged," .github/reports/dependency_versions_latest.csv 2>/dev/null || echo "0")
77-
77+
7878
# Parse removed dependencies from JSON
7979
if [ -f ".github/reports/removed_dependencies.json" ]; then
8080
removed_count=$(python3 -c "import json; print(json.load(open('.github/reports/removed_dependencies.json'))['count'])" 2>/dev/null || echo "0")
81-
82-
# Format removed dependencies list for PR body (limit to first 10)
83-
removed_list=$(python3 << 'PYTHON_SCRIPT'
84-
import json
85-
try:
86-
data = json.load(open('.github/reports/removed_dependencies.json'))
87-
removed = data['removed'][:10]
88-
lines = []
89-
for dep in removed:
90-
critical = ' **[CRITICAL]**' if dep.get('Critical') == 'Yes' else ''
91-
lines.append(f" • **{dep['Dependency Name']}** (was: `{dep['Version']}`){critical}")
92-
lines.append(f" _from {dep['Source File']}_")
93-
94-
if data['count'] > 10:
95-
lines.append(f" _... and {data['count'] - 10} more (see CSV for full list)_")
96-
97-
print('\n'.join(lines))
98-
except:
99-
print(' _No removed dependencies_')
100-
PYTHON_SCRIPT
101-
)
81+
82+
# Simple formatting - just list names and versions
83+
removed_list=$(python3 -c "import json; data=json.load(open('.github/reports/removed_dependencies.json')); removed=data['removed'][:10]; lines=[]; [lines.extend([f\" • **{d['Dependency Name']}** (was: \\\`{d['Version']}\\\`){' **[CRITICAL]**' if d.get('Critical')=='Yes' else ''}\", f\" _from {d['Source File']}_\"]) for d in removed]; (lines.append(f\" _... and {data['count']-10} more_\") if data['count']>10 else None); print('\\n'.join(lines))" 2>/dev/null || echo " _Unable to parse removed dependencies_")
10284
else
10385
removed_count="0"
10486
removed_list=" _No removed dependencies_"
10587
fi
106-
88+
10789
echo "new_deps=$new_count" >> $GITHUB_OUTPUT
10890
echo "changed_deps=$changed_count" >> $GITHUB_OUTPUT
10991
echo "unchanged_deps=$unchanged_count" >> $GITHUB_OUTPUT
@@ -114,7 +96,7 @@ PYTHON_SCRIPT
11496
else
11597
echo "has_changes=false" >> $GITHUB_OUTPUT
11698
fi
117-
99+
118100
- name: Create Pull Request
119101
if: steps.check_changes.outputs.has_changes == 'true'
120102
uses: peter-evans/create-pull-request@v6
@@ -124,36 +106,36 @@ PYTHON_SCRIPT
124106
title: '[Automated] Nightly Dependency Version Update - $(date +%Y-%m-%d)'
125107
body: |
126108
## 🤖 Automated Dependency Version Update
127-
109+
128110
This PR contains the nightly dependency extraction results.
129-
111+
130112
### 📊 Summary
131113
- **New Dependencies:** ${{ steps.check_changes.outputs.new_deps }}
132114
- **Changed Versions:** ${{ steps.check_changes.outputs.changed_deps }}
133115
- **Removed Dependencies:** ${{ steps.check_changes.outputs.removed_deps }}
134116
- **Unchanged:** ${{ steps.check_changes.outputs.unchanged_deps }}
135-
117+
136118
### 🗑️ Removed Dependencies
137119
${{ steps.check_changes.outputs.removed_list }}
138-
120+
139121
### 📋 Files Updated
140122
- ✅ `.github/reports/dependency_versions_latest.csv` - Latest dependency snapshot
141123
- ✅ `.github/reports/unversioned_dependencies_latest.csv` - Unversioned deps report (if applicable)
142-
124+
143125
> **Note:** Timestamped versions are stored in GitHub Artifacts (90-day retention) to avoid repo clutter.
144-
126+
145127
### ✔️ Review Checklist
146128
- [ ] Review new dependencies for security/licensing concerns
147129
- [ ] Check version changes for breaking updates
148130
- [ ] Review removed dependencies (intentional?)
149131
- [ ] Verify unversioned dependencies report
150132
- [ ] Update baseline count if increase is expected
151-
133+
152134
---
153-
135+
154136
🔗 **Documentation:** [Dependency Extraction Guide](../docs/dependency_extraction.md)
155137
📦 **Artifacts:** Download timestamped CSVs from workflow run
156-
138+
157139
_Generated by nightly dependency extraction workflow_
158140
_Timestamp: ${{ env.TIMESTAMP }}_
159141
branch: automated/dependency-extraction-${{ github.run_number }}
@@ -162,7 +144,7 @@ PYTHON_SCRIPT
162144
automated
163145
dependencies
164146
documentation
165-
147+
166148
- name: Upload artifacts
167149
if: always()
168150
uses: actions/upload-artifact@v4
@@ -172,7 +154,7 @@ PYTHON_SCRIPT
172154
.github/reports/dependency_versions_*.csv
173155
.github/reports/unversioned_dependencies_*.csv
174156
retention-days: 90
175-
157+
176158
- name: Summary
177159
if: always()
178160
run: |

.github/workflows/dependency-extraction-release.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ permissions:
3333
jobs:
3434
snapshot-dependencies:
3535
runs-on: ubuntu-latest
36-
36+
3737
steps:
3838
- name: Checkout repository
3939
uses: actions/checkout@v4
4040
with:
4141
fetch-depth: 0
42-
42+
4343
- name: Set up Python
4444
uses: actions/setup-python@v5
4545
with:
4646
python-version: '3.12'
47-
47+
4848
- name: Install dependencies
4949
run: pip install pyyaml
50-
50+
5151
- name: Extract version from branch or input
5252
id: version
5353
run: |
@@ -57,32 +57,32 @@ jobs:
5757
# Extract from branch name: release/1.2.3 -> 1.2.3
5858
VERSION=$(echo "${{ github.ref_name }}" | sed 's/release\///')
5959
fi
60-
60+
6161
# Validate version format (X.Y.Z)
6262
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6363
echo "Error: Invalid version format '$VERSION'. Expected X.Y.Z"
6464
exit 1
6565
fi
66-
66+
6767
echo "version=$VERSION" >> $GITHUB_OUTPUT
6868
echo "📦 Creating dependency snapshot for version: v$VERSION"
69-
69+
7070
- name: Run dependency extraction
7171
run: |
7272
VERSION="${{ steps.version.outputs.version }}"
73-
73+
7474
# Create versioned snapshot
7575
mkdir -p .github/reports/releases
7676
python3 .github/workflows/extract_dependency_versions.py \
7777
--output .github/reports/releases/dependency_versions_v${VERSION}.csv
78-
78+
7979
echo "VERSION=${VERSION}" >> $GITHUB_ENV
80-
80+
8181
- name: Check if snapshot already exists
8282
id: check_exists
8383
run: |
8484
VERSION="${{ steps.version.outputs.version }}"
85-
85+
8686
# Check if this version snapshot already exists in git
8787
if git ls-files --error-unmatch ".github/reports/releases/dependency_versions_v${VERSION}.csv" 2>/dev/null; then
8888
echo "exists=true" >> $GITHUB_OUTPUT
@@ -91,7 +91,7 @@ jobs:
9191
echo "exists=false" >> $GITHUB_OUTPUT
9292
echo "✅ Creating new snapshot for v${VERSION}"
9393
fi
94-
94+
9595
- name: Create Pull Request
9696
if: steps.check_exists.outputs.exists == 'false'
9797
uses: peter-evans/create-pull-request@v6
@@ -101,53 +101,53 @@ jobs:
101101
title: '[Release] Dependency Snapshot v${{ steps.version.outputs.version }}'
102102
body: |
103103
## 📸 Release Dependency Snapshot
104-
104+
105105
This PR adds a permanent dependency snapshot for **release v${{ steps.version.outputs.version }}**.
106-
106+
107107
### 📋 Files Added
108108
- `.github/reports/releases/dependency_versions_v${{ steps.version.outputs.version }}.csv`
109-
109+
110110
### 📊 Purpose
111111
This snapshot captures the exact dependency versions used in this release for:
112112
- 🔍 Historical tracking and auditing
113113
- 🐛 Debugging version-specific issues
114114
- 📈 Comparing dependency evolution across releases
115115
- 🔒 Compliance and security reviews
116-
116+
117117
### ✔️ Review Checklist
118118
- [ ] Verify this is the correct release version
119119
- [ ] Check that snapshot doesn't already exist
120120
- [ ] Review any new or changed dependencies
121-
121+
122122
---
123-
123+
124124
🔗 **Release Branch:** `${{ github.ref_name }}`
125125
📦 **Version:** v${{ steps.version.outputs.version }}
126-
126+
127127
_Generated by release dependency snapshot workflow_
128128
branch: release-snapshot/v${{ steps.version.outputs.version }}
129129
delete-branch: true
130130
labels: |
131131
release
132132
dependencies
133133
documentation
134-
134+
135135
- name: Upload snapshot artifact
136136
if: always()
137137
uses: actions/upload-artifact@v4
138138
with:
139139
name: dependency-snapshot-v${{ steps.version.outputs.version }}
140140
path: .github/reports/releases/dependency_versions_v${{ steps.version.outputs.version }}.csv
141141
retention-days: 365 # Keep release snapshots for 1 year
142-
142+
143143
- name: Summary
144144
if: always()
145145
run: |
146146
VERSION="${{ steps.version.outputs.version }}"
147-
147+
148148
echo "## Release Dependency Snapshot" >> $GITHUB_STEP_SUMMARY
149149
echo "" >> $GITHUB_STEP_SUMMARY
150-
150+
151151
if [[ "${{ steps.check_exists.outputs.exists }}" == "true" ]]; then
152152
echo "ℹ️ **Snapshot Already Exists**" >> $GITHUB_STEP_SUMMARY
153153
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)