2424 with :
2525 fetch-depth : 0
2626
27+ - name : Configure Git
28+ run : |
29+ git config --global user.name "github-actions[bot]"
30+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
31+ git config --global --add safe.directory /github/workspace
32+
2733 - name : Set up Python
2834 uses : actions/setup-python@v5
2935 with :
@@ -129,100 +135,100 @@ jobs:
129135
130136 # Basic YAML validation using Python
131137 python -c "
132- import yaml
133- import sys
134- try :
135- with open('$action_yml', 'r') as f :
136- content = f.read()
137-
138- # Skip header comments for YAML parsing
139- yaml_content = '\n'.join(line for line in content.split('\n') if not line.strip().startswith('#'))
140- config = yaml.safe_load(yaml_content)
141-
142- # Check required GitHub Action fields
143- required_fields = ['name', 'runs']
144- missing = [field for field in required_fields if field not in config]
145-
146- if missing :
147- print(f'❌ Missing required fields in $action_name : {missing}')
148- sys.exit(1)
149-
150- # Check runs configuration
151- if 'using' not in config['runs'] :
152- print(f'❌ Missing runs.using in $action_name')
153- sys.exit(1)
154-
155- print(f'✅ $action_name is valid GitHub Action')
156-
157- except Exception as e :
158- print(f'❌ Error validating $action_name : {e}')
159- sys.exit(1)
160- "
161- fi
162- done
163-
164- - name: Upload Test Results
165- if: always()
166- uses: actions/upload-artifact@v4
167- with:
168- name: bridge-test-results
169- path: |
170- .bridge/test-results.json
171- .bridge/validation-report.txt
172- retention-days: 30
173-
174- - name: Comment Test Results
175- if: github.event_name == 'pull_request'
176- uses: actions/github-script@v7
177- with:
178- script: |
179- const fs = require('fs');
180-
181- let comment = '## 🔗 Bridge Test Results\n\n ';
182-
183- try {
184- // Read test results if available
185- if (fs.existsSync('.bridge/test-results.json')) {
186- const results = JSON.parse(fs.readFileSync('.bridge/test-results.json', 'utf8'));
187- const summary = results.summary;
188-
189- comment += `### Test Summary\n `;
190- comment += `- **Total Tests**: ${summary.total}\n `;
191- comment += `- **Passed**: ${summary.passed} ✅\n `;
192- comment += `- **Failed**: ${summary.failed} ${summary.failed > 0 ? '❌' : ''}\n `;
193- comment += `- **Skipped**: ${summary.skipped} ⏭️\n `;
138+ import yaml
139+ import sys
140+ try:
141+ with open('$action_yml', 'r') as f:
142+ content = f.read()
143+
144+ # Skip header comments for YAML parsing
145+ yaml_content = '\n'.join(line for line in content.split('\n') if not line.strip().startswith('#'))
146+ config = yaml.safe_load(yaml_content)
147+
148+ # Check required GitHub Action fields
149+ required_fields = ['name', 'runs']
150+ missing = [field for field in required_fields if field not in config]
151+
152+ if missing:
153+ print(f'❌ Missing required fields in $action_name: {missing}')
154+ sys.exit(1)
155+
156+ # Check runs configuration
157+ if 'using' not in config['runs']:
158+ print(f'❌ Missing runs.using in $action_name')
159+ sys.exit(1)
160+
161+ print(f'✅ $action_name is valid GitHub Action')
162+
163+ except Exception as e:
164+ print(f'❌ Error validating $action_name: {e}')
165+ sys.exit(1)
166+ "
167+ fi
168+ done
194169
195- const successRate = summary.total > 0 ? (summary.passed / summary.total * 100).toFixed(1) : 0;
196- comment += `- **Success Rate**: ${successRate}%\n\n `;
170+ - name: Upload Test Results
171+ if: always()
172+ uses: actions/upload-artifact@v4
173+ with:
174+ name: bridge-test-results
175+ path: |
176+ .bridge/test-results.json
177+ .bridge/validation-report.txt
178+ retention-days: 30
197179
198- if (summary.failed > 0) {
199- comment += `### Failed Tests\n `;
200- const failedTests = results.tests.filter(t => t.status === 'failed');
201- failedTests.forEach(test => {
202- comment += `- ❌ **${test.name}**: ${test.message}\n `;
203- });
204- comment += '\n ';
205- }
206- } else {
207- comment += 'Test results file not found.\n\n ';
208- }
209- } catch (error) {
210- comment += `Error reading test results: ${error.message}\n\n `;
211- }
212-
213- comment += `### Architecture Status\n `;
214- comment += `- FCM Definitions: \` axioms/\` \n `;
215- comment += `- Generated Actions: \` actions/core/\` \n `;
216- comment += `- Bridge Infrastructure: \` .bridge/\` \n\n `;
217- comment += `For detailed results, check the workflow artifacts.`;
218-
219- // Post comment
220- github.rest.issues.createComment({
221- issue_number: context.issue.number,
222- owner: context.repo.owner,
223- repo: context.repo.repo,
224- body: comment
225- });
180+ - name: Comment Test Results
181+ if: github.event_name == 'pull_request'
182+ uses: actions/github-script@v7
183+ with:
184+ script: |
185+ const fs = require('fs');
186+
187+ let comment = '## 🔗 Bridge Test Results\n\n';
188+
189+ try {
190+ // Read test results if available
191+ if (fs.existsSync('.bridge/test-results.json')) {
192+ const results = JSON.parse(fs.readFileSync('.bridge/test-results.json', 'utf8'));
193+ const summary = results.summary;
194+
195+ comment += `### Test Summary\n`;
196+ comment += `- **Total Tests**: ${summary.total}\n`;
197+ comment += `- **Passed**: ${summary.passed} ✅\n`;
198+ comment += `- **Failed**: ${summary.failed} ${summary.failed > 0 ? '❌' : ''}\n`;
199+ comment += `- **Skipped**: ${summary.skipped} ⏭️\n`;
200+
201+ const successRate = summary.total > 0 ? (summary.passed / summary.total * 100).toFixed(1) : 0;
202+ comment += `- **Success Rate**: ${successRate}%\n\n`;
203+
204+ if (summary.failed > 0) {
205+ comment += `### Failed Tests\n`;
206+ const failedTests = results.tests.filter(t => t.status === 'failed');
207+ failedTests.forEach(test => {
208+ comment += `- ❌ **${test.name}**: ${test.message}\n`;
209+ });
210+ comment += '\n';
211+ }
212+ } else {
213+ comment += 'Test results file not found.\n\n';
214+ }
215+ } catch (error) {
216+ comment += `Error reading test results: ${error.message}\n\n`;
217+ }
218+
219+ comment += `### Architecture Status\n`;
220+ comment += `- FCM Definitions: \`axioms/\`\n`;
221+ comment += `- Generated Actions: \`actions/core/\`\n`;
222+ comment += `- Bridge Infrastructure: \`.bridge/\`\n\n`;
223+ comment += `For detailed results, check the workflow artifacts.`;
224+
225+ // Post comment
226+ github.rest.issues.createComment({
227+ issue_number: context.issue.number,
228+ owner: context.repo.owner,
229+ repo: context.repo.repo,
230+ body: comment
231+ });
226232
227233 action-tests :
228234 name : Test Generated Actions
@@ -233,14 +239,16 @@ except Exception as e:
233239 - name : Checkout Repository
234240 uses : actions/checkout@v4
235241
242+ - name : Configure Git
243+ run : |
244+ git config --global user.name "github-actions[bot]"
245+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
246+ git config --global --add safe.directory /github/workspace
247+
236248 - name : Test Tag Operations Action
237249 run : |
238250 echo "=== Testing Tag Operations Action ==="
239251
240- # Set up git for testing
241- git config user.name "Test User"
242- git config user.email "test@example.com"
243-
244252 # Test the generated tag-operations action if it exists
245253 if [ -d "actions/core/tag-operations" ]; then
246254 echo "Found generated tag-operations action"
@@ -272,43 +280,43 @@ except Exception as e:
272280
273281 # Use Python to parse and validate the action interface
274282 python -c "
275- import yaml
276- import sys
283+ import yaml
284+ import sys
277285
278- try :
279- with open('$action_dir/action.yml', 'r') as f :
280- content = f.read()
281-
282- # Skip header comments
283- yaml_content = '\n'.join(line for line in content.split('\n') if not line.strip().startswith('#'))
284- config = yaml.safe_load(yaml_content)
285-
286- # Validate inputs
287- inputs = config.get('inputs', {})
288- if not inputs :
289- print(f'⚠️ $action_name has no inputs')
290- else :
291- for input_name, input_config in inputs.items() :
292- if 'description' not in input_config :
293- print(f'❌ $action_name input {input_name} missing description')
294- sys.exit(1)
295- if 'required' not in input_config :
296- print(f'❌ $action_name input {input_name} missing required field')
297- sys.exit(1)
298- print(f'✅ $action_name has {len(inputs)} valid inputs')
299-
300- # Validate outputs
301- outputs = config.get('outputs', {})
302- if outputs :
303- for output_name, output_config in outputs.items() :
304- if 'description' not in output_config :
305- print(f'❌ $action_name output {output_name} missing description')
306- sys.exit(1)
307- print(f'✅ $action_name has {len(outputs)} valid outputs')
308-
309- except Exception as e :
310- print(f'❌ Error validating $action_name interface : {e}')
311- sys.exit(1)
312- "
313- fi
314- done
286+ try:
287+ with open('$action_dir/action.yml', 'r') as f:
288+ content = f.read()
289+
290+ # Skip header comments
291+ yaml_content = '\n'.join(line for line in content.split('\n') if not line.strip().startswith('#'))
292+ config = yaml.safe_load(yaml_content)
293+
294+ # Validate inputs
295+ inputs = config.get('inputs', {})
296+ if not inputs:
297+ print(f'⚠️ $action_name has no inputs')
298+ else:
299+ for input_name, input_config in inputs.items():
300+ if 'description' not in input_config:
301+ print(f'❌ $action_name input {input_name} missing description')
302+ sys.exit(1)
303+ if 'required' not in input_config:
304+ print(f'❌ $action_name input {input_name} missing required field')
305+ sys.exit(1)
306+ print(f'✅ $action_name has {len(inputs)} valid inputs')
307+
308+ # Validate outputs
309+ outputs = config.get('outputs', {})
310+ if outputs:
311+ for output_name, output_config in outputs.items():
312+ if 'description' not in output_config:
313+ print(f'❌ $action_name output {output_name} missing description')
314+ sys.exit(1)
315+ print(f'✅ $action_name has {len(outputs)} valid outputs')
316+
317+ except Exception as e:
318+ print(f'❌ Error validating $action_name interface: {e}')
319+ sys.exit(1)
320+ "
321+ fi
322+ done
0 commit comments