Skip to content

Prince/ add shiftai workflows #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

prince-deriv
Copy link
Collaborator

No description provided.

- AI Code Analysis: Analyzes AI-generated code in PRs with workflow_call support
- AI Dashboard: Tracks merged PRs and maintains AI usage dashboard
- Self-contained with included generate-dashboard.js script
- Comprehensive security validations and reusable inputs
- Move ai-code-analysis.yml to .github/workflows/ (required by GitHub)
- Move ai-dashboard.yml to .github/workflows/ (required by GitHub)
- Move scripts to .github/scripts/ (correct path)
- Fixes: workflows must be defined at the top level of .github/workflows/
- Move tokens from inputs to secrets section (GitHub requirement)
- PERSONAL_ACCESS_TOKEN now properly handled as secret
- GITHUB_TOKEN and SHIFTAI_TOKEN use secrets context
- Simplified inputs to only essential customizations
- Follows GitHub's security best practices
- Rename GITHUB_TOKEN to GH_TOKEN (GitHub reserves GITHUB_TOKEN)
- Fixes error: secret name GITHUB_TOKEN within workflow_call collides with system reserved name
- Maintains same functionality with non-reserved secret name
- Remove explicit secret definitions that aren't needed with inherit
- Use original GITHUB_TOKEN name (works with inherit)
- Cleaner calling syntax: just 'secrets: inherit'
- Maintains compatibility with explicit secret passing
- Remove undefined secrets.GITHUB_TOKEN references
- Use github.token which is always available
- Add test file with AI code blocks for testing
- Ready for production use with 'secrets: inherit'
- Remove workflow_call section entirely
- Let's see what the actual error is now
- Will add back with proper fix once we identify root cause
- Restore workflow_call section after debugging
- Only define PERSONAL_ACCESS_TOKEN in secrets
- Use github.token directly, no secrets.GITHUB_TOKEN reference
- Should fix Invalid secret GITHUB_TOKEN is not defined error
- Define GITHUB_TOKEN as optional secret to support secrets: inherit
- Required when caller uses secrets: inherit with GITHUB_TOKEN
- Should fix persistent Invalid secret GITHUB_TOKEN not defined error
…llision

- Remove GITHUB_TOKEN from workflow_call secrets (GitHub reserved name)
- Keep only PERSONAL_ACCESS_TOKEN as required secret
- Use github.token directly in workflow (always available)
- Breaks the catch-22 loop - ready for production
- Add github_token as optional input to avoid reserved name collision
- Use inputs.github_token || github.token pattern
- Should finally resolve the persistent GITHUB_TOKEN validation error
- Avoids GitHub's secret reserved name restrictions
- Minimal reusable workflow to test basic functionality
- No complex logic, just echo statements
- Will help isolate if issue is workflow complexity or basic setup
- Simple test workflow worked, confirming basic setup is fine
- Issue was specific to our complex AI workflow
- Ready to test actual AI workflow now
- Replace external script download with inline script creation
- Fixes 404 error when workflow tries to download from non-existent repo
- Remove separate .github/scripts/generate-dashboard.js file (no longer needed)
- Now works correctly in reusable workflow context
- Remove remaining pull_request_target trigger
- Now both workflows are pure reusable workflows
- No automatic execution on shared-actions repo
…cript

- Fixes SyntaxError: Invalid or unexpected token
- Template literals with YAML heredoc were causing escaping issues
- Pure string concatenation avoids all YAML/JavaScript interaction problems
- ✅ Syntax test passed - script generation now works correctly
- Changed from date-only (2024-08-01) to date+time (2024-08-01 14:30:15 UTC)
- Ensures AI-DASHBOARD.md always has unique content on each run
- Prevents multiple runs on same day from generating identical content
- Now both history.json AND dashboard.md will be committed every time
- Remove 'summary' object wrapper for consistency
- All entries now have percentage/totalCharacters/aiCharacters at root level
- Simplify data access logic (no more dual format handling)
- Workflow now always generates consistent format
- ✅ Eliminates TypeError: Cannot read properties of undefined
- Parse structured JSON data from AI analysis comments
- Extract file details instead of hardcoding files: []
- Fallback to regex parsing if JSON extraction fails
- ✅ Test passed - files array now populated correctly
- Dashboard will show actual file counts and details
- Replace problematic regex /[\s\S]*?/ that breaks in bash heredoc
- Use indexOf() and substring() for safer JSON extraction
- Eliminates shell escaping issues in YAML workflows
- ✅ Test passed - JSON parsing works without regex complexity
- Fixes: syntax error near unexpected token and eval syntax errors
- Replace 'node -e "..."' with 'cat << EOF > script.js; node script.js'
- Eliminates bash trying to interpret JavaScript as shell commands
- ✅ Test passed: Real AI comment parsing works perfectly (1 file, 94 chars)
- Fixes: command not found errors and ReferenceError scope issues
- Resolves: Cannot access 'jsonStart' before initialization
- Remove problematic cat << 'EOF' ... EOF construct
- Replace with clean node -e command for inline JavaScript
- Fixes YAML syntax highlighting and validation issues
- Eliminates EOF terminator positioning problems
@prince-deriv prince-deriv deleted the add-shiftai-workflows branch August 1, 2025 12:20
@prince-deriv prince-deriv restored the add-shiftai-workflows branch August 1, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant