Skip to content

Commit e4602cc

Browse files
authored
Merge pull request #65 from alex-feel/alex-feel-dev
Remove gist creation from badge update workflow
2 parents 61eb2f1 + c0fd20c commit e4602cc

File tree

2 files changed

+30
-69
lines changed

2 files changed

+30
-69
lines changed

.github/workflows/update-badges.yml

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -47,49 +47,7 @@ jobs:
4747
run: |
4848
uv run python scripts/count_entities.py
4949
50-
- name: Upload badge data to Gist
51-
id: gist
52-
uses: actions/github-script@v7
53-
with:
54-
github-token: ${{ secrets.GITHUB_TOKEN }}
55-
script: |
56-
const fs = require('fs');
57-
const path = require('path');
58-
59-
// Read the generated badge data
60-
const badgeDir = path.join(process.cwd(), '.github', 'badges');
61-
const files = {};
62-
63-
// Read all JSON files
64-
const fileNames = fs.readdirSync(badgeDir).filter(f => f.endsWith('.json'));
65-
for (const fileName of fileNames) {
66-
const content = fs.readFileSync(path.join(badgeDir, fileName), 'utf8');
67-
files[fileName] = { content };
68-
}
69-
70-
// Get or create gist
71-
const gistId = '${{ secrets.GIST_ID }}'; // Store gist ID as secret after first creation
72-
73-
if (gistId) {
74-
// Update existing gist
75-
await github.rest.gists.update({
76-
gist_id: gistId,
77-
files: files
78-
});
79-
console.log(`Updated gist: ${gistId}`);
80-
} else {
81-
// Create new gist (first run only)
82-
const result = await github.rest.gists.create({
83-
description: 'Claude Code Toolbox Entity Counts',
84-
public: true,
85-
files: files
86-
});
87-
console.log(`Created gist: ${result.data.id}`);
88-
console.log('Add this ID as GIST_ID secret in repository settings');
89-
core.setOutput('gist_id', result.data.id);
90-
}
91-
92-
- name: Commit badge data (alternative approach)
50+
- name: Commit badge data
9351
run: |
9452
git config --local user.email "github-actions[bot]@users.noreply.github.com"
9553
git config --local user.name "github-actions[bot]"

.github/workflows/validate-configs.yml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ name: Validate Environment Configs
22

33
on:
44
pull_request:
5-
paths:
6-
- 'environments/library/**/*.yaml'
7-
- 'environments/library/**/*.yml'
8-
- 'environments/templates/**/*.yaml'
9-
- 'environments/templates/**/*.yml'
10-
- 'scripts/validate_environment_config.py'
11-
- 'scripts/models/environment_config.py'
12-
- '.github/workflows/validate-configs.yml'
5+
# Remove path filters to ensure workflow always runs
136

147
permissions:
158
contents: read
@@ -26,33 +19,38 @@ jobs:
2619
with:
2720
fetch-depth: 0 # Get full history for diff
2821

29-
- name: Set up Python 3.12
30-
uses: actions/setup-python@v5
31-
with:
32-
python-version: '3.12'
33-
34-
- name: Install dependencies
22+
- name: Check for relevant changes
23+
id: check-changes
3524
run: |
36-
python -m pip install --upgrade pip
37-
pip install pyyaml pydantic
25+
# Check if any environment config files were changed
26+
git diff --name-only origin/${{ github.base_ref }}..HEAD > all-changes.txt
3827
39-
- name: Get changed config files
40-
id: changed-files
41-
run: |
42-
# Get list of changed YAML files in environments/
43-
git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'environments/.+\.(yaml|yml)$' > changed-configs.txt || true
28+
# Filter for environment config files
29+
grep -E 'environments/.+\.(yaml|yml)$|scripts/validate_environment_config.py|scripts/models/environment_config.py' all-changes.txt > changed-configs.txt || true
4430
4531
if [ -s changed-configs.txt ]; then
4632
echo "has_changes=true" >> $GITHUB_OUTPUT
47-
echo "Changed configuration files:"
33+
echo "Environment configuration files were changed:"
4834
cat changed-configs.txt
4935
else
5036
echo "has_changes=false" >> $GITHUB_OUTPUT
51-
echo "No configuration files changed"
37+
echo "No environment configuration files were changed - skipping validation"
5238
fi
5339
40+
- name: Set up Python 3.12
41+
if: steps.check-changes.outputs.has_changes == 'true'
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.12'
45+
46+
- name: Install dependencies
47+
if: steps.check-changes.outputs.has_changes == 'true'
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install pyyaml pydantic
51+
5452
- name: Validate changed configurations
55-
if: steps.changed-files.outputs.has_changes == 'true'
53+
if: steps.check-changes.outputs.has_changes == 'true'
5654
run: |
5755
echo "Validating changed configuration files..."
5856
exit_code=0
@@ -83,8 +81,13 @@ jobs:
8381
echo "✅ All configuration files validated successfully"
8482
fi
8583
84+
- name: Skip validation message
85+
if: steps.check-changes.outputs.has_changes == 'false'
86+
run: |
87+
echo "✅ No environment configuration changes to validate"
88+
8689
- name: Comment PR with validation success
87-
if: success() && steps.changed-files.outputs.has_changes == 'true'
90+
if: success() && steps.check-changes.outputs.has_changes == 'true'
8891
uses: actions/github-script@v7
8992
with:
9093
script: |
@@ -100,7 +103,7 @@ jobs:
100103
});
101104
102105
- name: Comment PR with validation failure
103-
if: failure() && steps.changed-files.outputs.has_changes == 'true'
106+
if: failure() && steps.check-changes.outputs.has_changes == 'true'
104107
uses: actions/github-script@v7
105108
with:
106109
script: |

0 commit comments

Comments
 (0)