Skip to content
Merged
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
37 changes: 27 additions & 10 deletions .github/workflows/copilot-pr-nlp-analysis.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 14 additions & 25 deletions .github/workflows/copilot-pr-nlp-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ imports:
- shared/jqschema.md
- shared/python-dataviz.md
- shared/reporting.md
- shared/copilot-pr-data-fetch.md

tools:
cache-memory: true
Expand All @@ -41,36 +42,15 @@ tools:
bash: ["*"]

steps:
- name: Fetch Copilot PR data from last 24 hours
- name: Fetch PR comments for detailed analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create output directory
mkdir -p /tmp/gh-aw/pr-data
# Create comments directory
mkdir -p /tmp/gh-aw/pr-comments

# Calculate date 24 hours ago
DATE_24H_AGO=$(date -d '1 day ago' '+%Y-%m-%d' 2>/dev/null || date -v-1d '+%Y-%m-%d')

echo "Fetching Copilot PRs merged in the last 24 hours..."

# Search for PRs from copilot/* branches merged in the last 24 hours
# Using branch prefix search instead of author since it's more reliable
gh pr list --repo ${{ github.repository }} \
--search "head:copilot/ is:merged merged:>=${DATE_24H_AGO}" \
--state merged \
--json number,title,author,headRefName,createdAt,state,url,body,labels,updatedAt,closedAt,mergedAt \
--limit 100 \
> /tmp/gh-aw/pr-data/copilot-prs.json

# Generate schema for reference
/tmp/gh-aw/jqschema.sh < /tmp/gh-aw/pr-data/copilot-prs.json > /tmp/gh-aw/pr-data/copilot-prs-schema.json

echo "PR data saved to /tmp/gh-aw/pr-data/copilot-prs.json"
echo "Total PRs found: $(jq 'length' /tmp/gh-aw/pr-data/copilot-prs.json)"

# Fetch detailed comments for each PR
# Fetch detailed comments for each PR from the pre-fetched data
PR_COUNT=$(jq 'length' /tmp/gh-aw/pr-data/copilot-prs.json)
echo "Fetching comments for $PR_COUNT PRs..."

Expand Down Expand Up @@ -125,7 +105,16 @@ Generate a daily NLP-based analysis report of Copilot-created PRs merged within

### Phase 1: Load and Parse PR Conversation Data

**Pre-fetched Data Available**: The setup step has downloaded all Copilot PRs merged in the last 24 hours plus their conversation data.
**Pre-fetched Data Available**: The shared component has downloaded all Copilot PRs from the last 30 days. The data is available at:
- `/tmp/gh-aw/pr-data/copilot-prs.json` - Full PR data in JSON format
- `/tmp/gh-aw/pr-data/copilot-prs-schema.json` - Schema showing the structure

**Note**: This workflow focuses on merged PRs from the last 24 hours. Use jq to filter:
```bash
# Get PRs merged in the last 24 hours
DATE_24H_AGO=$(date -d '1 day ago' '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null || date -v-1d '+%Y-%m-%dT%H:%M:%SZ')
jq --arg date "$DATE_24H_AGO" '[.[] | select(.mergedAt != null and .mergedAt >= $date)]' /tmp/gh-aw/pr-data/copilot-prs.json
```

1. **Load PR metadata**:
```bash
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/copilot-pr-prompt-analysis.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 1 addition & 29 deletions .github/workflows/copilot-pr-prompt-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ safe-outputs:
imports:
- shared/jqschema.md
- shared/reporting.md
- shared/copilot-pr-data-fetch.md

tools:
cache-memory: true
Expand All @@ -46,35 +47,6 @@ tools:
- "jq *"
- "/tmp/gh-aw/jqschema.sh"

steps:
- name: Fetch Copilot PR data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create output directory
mkdir -p /tmp/gh-aw/pr-data

# Calculate date 30 days ago
DATE_30_DAYS_AGO=$(date -d '30 days ago' '+%Y-%m-%d' 2>/dev/null || date -v-30d '+%Y-%m-%d')

# Search for PRs from copilot/* branches in the last 30 days using gh CLI
# Using branch prefix search (head:copilot/) instead of author for reliability
echo "Fetching Copilot PRs from the last 30 days..."
gh pr list --repo ${{ github.repository }} \
--search "head:copilot/ created:>=${DATE_30_DAYS_AGO}" \
--state all \
--json number,title,author,headRefName,createdAt,state,url,body,labels,updatedAt,closedAt,mergedAt \
--limit 1000 \fi
> /tmp/gh-aw/pr-data/copilot-prs.json

# Generate schema for reference
/tmp/gh-aw/jqschema.sh < /tmp/gh-aw/pr-data/copilot-prs.json > /tmp/gh-aw/pr-data/copilot-prs-schema.json

echo "PR data saved to /tmp/gh-aw/pr-data/copilot-prs.json"
echo "Schema saved to /tmp/gh-aw/pr-data/copilot-prs-schema.json"
echo "Total PRs found: $(jq 'length' /tmp/gh-aw/pr-data/copilot-prs.json)"

timeout-minutes: 15

---
Expand Down
Loading
Loading