-
Notifications
You must be signed in to change notification settings - Fork 19
ci: post evals-monitor link comment on new PRs #430
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ef86b69
ci: post evals-monitor link comment on new PRs
calvarjorge 1663113
ci: refine eval PR comment (microscope emoji, 'Go to Evals Monitor' l…
calvarjorge 1876fb9
Merge branch 'main' into jorge_calvar/eval_pr_comment
calvarjorge 713492e
ci: serialize eval PR comment per-PR and skip fork PRs
calvarjorge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Eval PR Comment | ||
|
|
||
| # Posts a small comment on every new PR with a link to the evals-monitor app, | ||
| # where the author can start an eval for their PR. We post a link rather than | ||
| # triggering the job from CI because GitHub Actions runners cannot reach the | ||
| # dogfood.staging workspace (network perimeter). | ||
| on: | ||
| pull_request: | ||
| types: [opened, reopened] | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| # Serialize per-PR so a rapid open+reopen can't race the marker check and | ||
| # double-post. cancel-in-progress: false — the queued run still executes and | ||
| # deterministically sees the prior run's comment (then skips); there's no | ||
| # "latest commit wins" semantics here, the posted link is identical either way. | ||
| concurrency: | ||
| group: eval-pr-comment-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| post-eval-link: | ||
| name: Post eval link comment | ||
| # Skip fork PRs: their GITHUB_TOKEN is read-only (createComment would 403), | ||
| # and the evals-monitor app is internal — the link is useless to external | ||
| # contributors anyway. | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: | ||
| group: databricks-protected-runner-group | ||
| labels: linux-ubuntu-latest | ||
| steps: | ||
| - name: Post eval link comment | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
| with: | ||
| script: | | ||
| const marker = "<!-- pr-eval-link -->"; | ||
| const { owner, repo } = context.repo; | ||
| const issue_number = context.issue.number; | ||
| const url = `https://evals-monitor-6051921418418893.staging.aws.databricksapps.com/prs/appkit/${issue_number}`; | ||
|
|
||
| // Idempotent: skip if we've already commented on this PR. | ||
| const comments = await github.paginate(github.rest.issues.listComments, { | ||
| owner, | ||
| repo, | ||
| issue_number, | ||
| per_page: 100, | ||
| }); | ||
| if (comments.some((c) => c.body?.includes(marker))) return; | ||
|
|
||
| const body = `${marker}\n> 🔬 **Run evals on this PR** · [**Go to Evals Monitor →**](${url})`; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
|
calvarjorge marked this conversation as resolved.
|
||
| owner, | ||
| repo, | ||
| issue_number, | ||
| body, | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.