Add upstream change monitoring workflow with daily notifications to @sharpninja#1
Conversation
…y sharpninja Co-authored-by: sharpninja <16146732+sharpninja@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a GitHub Actions workflow to monitor divergence between this fork (sharpninja/graphrag) and the upstream repository (microsoft/graphrag). The workflow runs daily at 08:00 UTC and maintains a single GitHub issue that tracks outstanding commits from upstream, notifying @sharpninja on each update.
Changes:
- Added
.github/workflows/monitor-upstream.ymlwith scheduled daily runs - Implements git-based commit comparison using
git rev-listto count outstanding changes - Creates/updates a tracking issue with auto-generated summaries and
@mentionsfor notifications
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Fetch upstream | ||
| run: | | ||
| git remote add upstream https://github.com/microsoft/graphrag.git |
There was a problem hiding this comment.
The git remote add upstream command will fail on subsequent runs because the remote will already exist. This should use git remote add upstream ... || true or check if the remote exists first, or use git remote set-url upstream ... after checking.
| git remote add upstream https://github.com/microsoft/graphrag.git | |
| git remote add upstream https://github.com/microsoft/graphrag.git 2>/dev/null || git remote set-url upstream https://github.com/microsoft/graphrag.git |
| // Add a comment so @sharpninja receives a new notification | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issueNumber, | ||
| body: | ||
| `@sharpninja **Update ${now}**: ` + | ||
| `**${count}** outstanding change(s) from upstream detected.\n\n` + | ||
| `[View full comparison](${comparisonUrl})`, | ||
| }); |
There was a problem hiding this comment.
This workflow will create a new comment on every run (including when count is 0), which could generate unnecessary notifications. Consider only adding a comment when the count has changed or when there are actually outstanding changes. You could store the previous count in the issue body or check if the issue body has already been updated today.
| // Add a comment so @sharpninja receives a new notification | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| body: | |
| `@sharpninja **Update ${now}**: ` + | |
| `**${count}** outstanding change(s) from upstream detected.\n\n` + | |
| `[View full comparison](${comparisonUrl})`, | |
| }); | |
| // Only add a comment (and generate a notification) when there are outstanding changes | |
| if (count > 0) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| body: | |
| `@sharpninja **Update ${now}**: ` + | |
| `**${count}** outstanding change(s) from upstream detected.\n\n` + | |
| `[View full comparison](${comparisonUrl})`, | |
| }); | |
| } else { | |
| console.log('No outstanding upstream changes; skipping notification comment.'); | |
| } |
|
|
||
| const now = new Date().toUTCString(); | ||
| const comparisonUrl = | ||
| 'https://github.com/microsoft/graphrag/compare/main...sharpninja:graphrag:main'; |
There was a problem hiding this comment.
The comparison URL is incorrect. The format 'main...sharpninja:graphrag:main' compares the upstream main with the fork's main, but the direction is reversed. To show commits in upstream that aren't in the fork, it should be 'sharpninja:graphrag:main...microsoft:graphrag:main'. The three-dot syntax shows the symmetric difference, which may not be what's intended. Consider using 'sharpninja:graphrag:main..microsoft:graphrag:main' with two dots to show commits in upstream not in the fork.
| 'https://github.com/microsoft/graphrag/compare/main...sharpninja:graphrag:main'; | |
| 'https://github.com/microsoft/graphrag/compare/sharpninja:graphrag:main..microsoft:graphrag:main'; |
| echo "$COUNT" > /tmp/commit-count.txt | ||
| git log --oneline --no-merges -50 HEAD..upstream/main > /tmp/commit-list.txt 2>/dev/null || true |
There was a problem hiding this comment.
Using /tmp/ for temporary files works on Linux/macOS but the repository has workflows running on Windows (see python-integration-tests.yml, python-unit-tests.yml). If this workflow ever runs on Windows or if the pattern is copied to other workflows, it will fail. Consider using ${{ runner.temp }} which provides a cross-platform temporary directory path.
| // Update the issue body and title | ||
| await github.rest.issues.update({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issueNumber, | ||
| title, | ||
| body, |
There was a problem hiding this comment.
The comment mentions "@sharpninja" will receive a notification on each run, but the issue body on line 69 also contains "@sharpninja". This means the notification will be triggered both when the issue is created AND when it's updated (via the body update), in addition to the comment. Consider removing "@sharpninja" from the body to avoid duplicate notifications on updates.
| } catch { | ||
| await github.rest.issues.createLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| name: 'upstream-tracking', | ||
| color: '0075ca', | ||
| description: 'Tracks outstanding changes from the upstream microsoft/graphrag repository', | ||
| }); |
There was a problem hiding this comment.
The error handling for the catch block on line 49 is too broad. If the label doesn't exist, it attempts to create it, but if the catch is triggered by a network error, rate limit, or permissions issue, it will fail when trying to create the label with the same error. Consider logging the error or checking specifically for a 404 status to ensure you're only creating the label when it doesn't exist.
| } catch { | |
| await github.rest.issues.createLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: 'upstream-tracking', | |
| color: '0075ca', | |
| description: 'Tracks outstanding changes from the upstream microsoft/graphrag repository', | |
| }); | |
| } catch (error) { | |
| if (error && error.status === 404) { | |
| await github.rest.issues.createLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: 'upstream-tracking', | |
| color: '0075ca', | |
| description: 'Tracks outstanding changes from the upstream microsoft/graphrag repository', | |
| }); | |
| } else { | |
| console.error('Failed to ensure upstream-tracking label exists:', error); | |
| throw error; | |
| } |
Adds a scheduled GitHub Actions workflow to continuously track divergence between this fork and
microsoft/graphrag, keeping a running summary of outstanding changes and notifying@sharpninjaon each update.Description
Implements a daily workflow that fetches the upstream
microsoft/graphragmainbranch, computes commits not yet present in this fork, and maintains a single GitHub issue as a living summary — posting a new mention-comment each run to trigger a GitHub notification to@sharpninja.Related Issues
Upstream monitoring task for
sharpninja/graphragfork.Proposed Changes
.github/workflows/monitor-upstream.yml— new workflow with:schedule(daily at 08:00 UTC) +workflow_dispatchtriggersmicrosoft/graphragand counts/lists commits inupstream/mainnot yet merged into the fork (capped at 50 for readability)upstream-trackinglabel on first run if absentupstream-trackingwith the full pending-commit list and a comparison link@sharpninjato fire a GitHub notificationcontents: read+issues: writeonlyChecklist
Additional Notes
The workflow uses
git rev-list HEAD..upstream/mainto determine outstanding commits, so the count reflects commits reachable from upstreammainthat are not ancestors of the fork's currentHEAD. Only one tracking issue is kept open at a time; the workflow locates it by theupstream-trackinglabel.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.