Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .github/workflows/auto-assign-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ jobs:
const assignees = [copilotUsername]; // Or: ["copilot","anotheruser"]
const currentAssignees = context.payload.pull_request.assignees.map(u => u.login);
if (!assignees.every(a => currentAssignees.includes(a))) {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees
});
console.log(`Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`);
console.log(`PR has assignees to add. Attempting to assign ${assignees.join(", ")}...`);

try {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees
});
console.log(`✅ Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`);
} catch (error) {
console.log(`⚠️ Failed to assign users: ${error.message}`);
console.log("Note: This may be due to insufficient permissions or the user not being a collaborator.");
}
} else {
console.log(`Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`);
console.log(`ℹ️ Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`);
}
67 changes: 41 additions & 26 deletions .github/workflows/auto-complete-cicd-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,36 +358,51 @@ jobs:
`;

// Check for existing review issues
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['ci-cd-review', 'automated'],
per_page: 10
});

const recentIssue = issues.data.find(issue => {
const createdAt = new Date(issue.created_at);
const hoursSinceCreation = (Date.now() - createdAt) / (1000 * 60 * 60);
return hoursSinceCreation < 24;
});

if (recentIssue) {
console.log(`Recent issue found: #${recentIssue.number}, updating`);
await github.rest.issues.createComment({
try {
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: recentIssue.number,
body: `## Updated Review (${date})\n\n${report}`
state: 'open',
labels: ['ci-cd-review', 'automated'],
per_page: 10
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['ci-cd-review', 'automated', 'needs-review']

const recentIssue = issues.data.find(issue => {
const createdAt = new Date(issue.created_at);
const hoursSinceCreation = (Date.now() - createdAt) / (1000 * 60 * 60);
return hoursSinceCreation < 24;
});

if (recentIssue) {
console.log(`Recent issue found: #${recentIssue.number}, updating`);
try {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: recentIssue.number,
body: `## Updated Review (${date})\n\n${report}`
});
console.log(`✅ Updated existing issue #${recentIssue.number}`);
} catch (error) {
console.log(`⚠️ Failed to update existing issue: ${error.message}`);
}
} else {
try {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['ci-cd-review', 'automated', 'needs-review']
});
console.log(`✅ Created new review issue`);
} catch (error) {
console.log(`⚠️ Failed to create new issue: ${error.message}`);
}
}
} catch (error) {
console.log(`⚠️ Failed to list existing issues: ${error.message}`);
console.log("Note: This may be due to insufficient permissions.");
}

- name: Upload Final Report
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/auto-copilot-code-cleanliness-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,14 @@ jobs:
! -path "*/build/*" \
! -path "*/.venv/*" \
! -path "*/vendor/*" \
-exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null || echo 0); if [ "$count" -gt 20 ]; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \
-exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null || echo 0); count=${count:-0}; if [ "$count" -gt 20 ]; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \
2>/dev/null || true
done | sort -rn >> /tmp/analysis.md

cat /tmp/analysis.md

- name: GitHub Copilot Code Review
uses: github/copilot-cli-action@main
with:
query: |
Review the codebase for code cleanliness issues:
1. Identify files that are too large (>500 lines) and suggest how to split them into smaller, focused modules
2. Look for code duplication and suggest refactoring opportunities
3. Check for consistent code style and formatting
4. Identify complex functions that could be simplified
5. Suggest improvements for code organization and structure
6. Check for proper separation of concerns

Provide actionable recommendations with specific file names and line numbers.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
# Note: GitHub Copilot CLI action is not available as a public action
# Code cleanliness analysis is already performed in the previous step

- name: Create Issue for Code Cleanliness Review
uses: actions/github-script@main
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/auto-copilot-functionality-docs-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ jobs:
class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0)
docstring_count=$(grep -c '"""' "$file" 2>/dev/null || echo 0)

# Ensure variables are numeric
func_count=${func_count:-0}
class_count=${class_count:-0}
docstring_count=${docstring_count:-0}

total=$((func_count + class_count))
if [ $total -gt 0 ] && [ $docstring_count -eq 0 ]; then
echo "⚠️ $file: $total definitions, no docstrings" >> /tmp/doc-analysis.md
Expand All @@ -202,6 +207,11 @@ jobs:
class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0)
jsdoc_count=$(grep -c '/\*\*' "$file" 2>/dev/null || echo 0)

# Ensure variables are numeric
func_count=${func_count:-0}
class_count=${class_count:-0}
jsdoc_count=${jsdoc_count:-0}

total=$((func_count + class_count))
if [ $total -gt 5 ] && [ $jsdoc_count -eq 0 ]; then
echo "⚠️ $file: ~$total definitions, no JSDoc comments" >> /tmp/doc-analysis.md
Expand All @@ -211,24 +221,8 @@ jobs:

cat /tmp/doc-analysis.md

- name: GitHub Copilot Documentation Review
uses: github/copilot-cli-actions@v1
with:
query: |
Review the documentation for this repository:
1. Check README.md completeness and quality
2. Verify all features and functionality are documented
3. Check for installation and usage instructions
4. Identify missing or outdated documentation
5. Suggest improvements for clarity and completeness
6. Verify code comments and inline documentation
7. Check for API documentation if applicable
8. Ensure contributing guidelines are present

Provide specific recommendations with file names and sections.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
# Note: GitHub Copilot CLI actions are not available as a public action
# The documentation analysis is already performed in the previous step

- name: Create Documentation Review Report
uses: actions/github-script@main
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/auto-copilot-org-playwright-loop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ jobs:
pytest tests/ || exit 1
continue-on-error: true

# Copilot PR Agent auto-review (if available for org)
- name: Copilot PR Agent Review
uses: github/copilot-agent/pr@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
# Note: GitHub Copilot agent actions are not available as public actions
# This step would provide automated PR review
# For now, manual PR review is required

# Copilot Agent auto-fix (can loop up to N attempts if tests fail)
- name: Copilot Auto-fix Failing Playwright Tests
uses: github/copilot-agent/fix@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
max_attempts: 3 # Try up to 3 auto-fix loops!
continue-on-error: true
# Note: GitHub Copilot agent actions are not available as public actions
# This step would automatically fix failing Playwright tests with retry loops
# For now, manual test fixing is required

# Create PR with fixes (if any)
- name: Create Pull Request for Automated Fixes
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/auto-copilot-org-playwright-loopv2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,13 @@ jobs:
pytest tests/ || exit 1
continue-on-error: true

- name: Copilot PR Agent Review
uses: github/copilot-agent/pr@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
# Note: GitHub Copilot agent actions are not available as public actions
# This step would provide automated PR review
# For now, manual PR review is required

- name: Copilot Auto-fix Failing Playwright Tests
uses: github/copilot-agent/fix@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
max_attempts: 3
continue-on-error: true
# Note: GitHub Copilot agent actions are not available as public actions
# This step would automatically fix failing Playwright tests
# For now, manual test fixing is required

- name: Create Pull Request for Automated Fixes
uses: peter-evans/create-pull-request@main
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/auto-copilot-playwright-auto-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ jobs:
run: |
python -m playwright install

- name: Copilot Generate Playwright Scripts
uses: github/copilot-agent/playwright-generate@main # Example, customize for Python; or use Chat to generate script
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
prompt: "Generate Playwright test scripts covering every user action on this web app."
continue-on-error: true # If your agent doesn't support, replace with python script generation using Copilot Chat
# Note: GitHub Copilot agent actions are not available as public actions
# This step would generate Playwright test scripts automatically
# For now, manual test script creation is required

- name: Run Playwright Tests
run: |
pytest tests/ # Or the path to your Playwright scripts

- name: If Tests Fail, Copilot Attempts Fix & Repeats
uses: github/copilot-agent/playwright-fix-and-loop@main # Example, requires agent loop feature
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
max_attempts: 5
continue-on-error: true
# Note: GitHub Copilot agent actions are not available as public actions
# This step would automatically fix failing tests and retry
# For now, manual test fixing is required

- name: Create PR with passing tests or attempted fixes
uses: peter-evans/create-pull-request@main
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/auto-copilot-test-review-playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,8 @@ jobs:

cat /tmp/test-analysis.md

- name: GitHub Copilot Test Review
uses: github/copilot-cli-action@main
with:
query: |
Review the test suite for this repository:
1. Verify all web-based functionality has Playwright tests (both headed and headless)
2. Identify missing test coverage for critical functionality
3. Check test quality and maintainability
4. Suggest improvements for test organization
5. Verify tests follow best practices (isolation, clarity, proper assertions)
6. Check for flaky tests or tests with timing issues
7. Ensure tests are running in CI/CD pipeline

For any web tests not using Playwright, recommend migration.
Provide specific, actionable recommendations with file names.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
# Note: GitHub Copilot CLI action is not available as a public action
# Test analysis is already performed in the previous step

- name: Create or Update Test Review Issue
uses: actions/github-script@main
Expand Down
38 changes: 26 additions & 12 deletions .github/workflows/auto-label-comment-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,31 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr_number = context.payload.pull_request.number;

// Add label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
labels: ["needs-review", "copilot"] // <-- TUNE ME
});
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
labels: ["needs-review", "copilot"] // <-- TUNE ME
});
console.log(`✅ Added labels to PR #${pr_number}`);
} catch (error) {
console.log(`⚠️ Failed to add labels: ${error.message}`);
console.log("Note: This may be due to insufficient permissions or invalid label names.");
}

// Add automated comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
body: "Thanks for the PR! Copilot will assist with review."
});
try {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
body: "Thanks for the PR! Copilot will assist with review."
});
console.log(`✅ Added comment to PR #${pr_number}`);
} catch (error) {
console.log(`⚠️ Failed to add comment: ${error.message}`);
console.log("Note: This may be due to insufficient permissions.");
}
19 changes: 13 additions & 6 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ jobs:
script: |
// Add or tweak your labels here
const labels = ["triage", "copilot"]; // <-- TUNE ME!
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels
});

try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels
});
console.log(`✅ Added labels [${labels.join(", ")}] to issue #${context.issue.number}`);
} catch (error) {
console.log(`⚠️ Failed to add labels: ${error.message}`);
console.log("Note: This may be due to insufficient permissions or invalid label names.");
}
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ See the [examples directory](examples/) for more usage patterns.

For users who prefer to manage their own I/O:

## Sans-I/O Mode (Original)

For users who prefer to manage their own I/O:

```python
from cdp import page

Expand Down
16 changes: 16 additions & 0 deletions check_issues.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

echo "=== Searching for remaining shell arithmetic operations ==="
grep -r '\$((.*))' .github/workflows/ || echo "No shell arithmetic found"

echo ""
echo "=== Searching for remaining GitHub Copilot actions ==="
grep -r 'github/copilot' .github/workflows/ || echo "No GitHub Copilot actions found"

echo ""
echo "=== Searching for remaining shell arithmetic patterns ==="
grep -r '\$(' .github/workflows/ | grep -E '(count|total).*=' || echo "No problematic patterns found"

echo ""
echo "=== Checking for any uses: statements with copilot ==="
grep -r 'uses:.*copilot' .github/workflows/ || echo "No copilot uses statements found"
Loading
Loading