Repository navigation
Automated Testing: Add GitHub Actions workflow for review routing (diagnostic only) #86449
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
e66a2d2
Automated Testing: Add review routing CI step
aduth b4dbf6d
TEMPORARY: Run review routing in pull request (for demonstration)
aduth 5f596f0
Add prefix qualifier for variables describing purpose
aduth ed9ef3b
Automated Testing: Remove temporary pull_request event for review rou…
aduth 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,70 @@ | ||
| name: Review routing | ||
|
|
||
| on: | ||
| # Runs this workflow from the target branch, not from the pull request. | ||
| # This makes it safe to give the job the decision API key, also for pull | ||
| # requests from forks. The job reads the pull request only through the | ||
| # GitHub API, and never runs its code. | ||
| pull_request_target: | ||
| types: [opened, reopened, synchronize, ready_for_review] | ||
|
|
||
| # Disable permissions for all available scopes by default. | ||
| # Any needed permissions should be configured at the job level. | ||
| permissions: {} | ||
|
|
||
| # Only the newest commit needs scores. | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| route: | ||
| name: Score the routing rules | ||
| # Pull requests to release branches are backports, which need no | ||
| # routing. A draft gets its scores when it is ready for review. | ||
| if: ${{ ! github.event.pull_request.draft && github.event.pull_request.base.ref == github.event.repository.default_branch }} | ||
| runs-on: 'ubuntu-slim' | ||
| # This job has the API key, so its token can only read. The report goes | ||
| # to the run summary, so the job writes nothing to the pull request. | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| timeout-minutes: 5 | ||
|
|
||
| steps: | ||
| # On `pull_request_target`, this checks out the base branch. The | ||
| # tool has no runtime dependencies, so `npm run` needs no install. | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| sparse-checkout: | | ||
| tools/review-routing | ||
| .github/review-routing | ||
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
| persist-credentials: false | ||
|
|
||
| # The npm that comes with this Node.js meets the `devEngines` floor | ||
| # in package.json, so the job does not install another npm. | ||
| - name: Use desired version of Node.js | ||
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| check-latest: true | ||
| package-manager-cache: false | ||
|
|
||
| # The scores do not request reviews yet, and CODEOWNERS still does. | ||
| # So a failure, such as a model that does not respond, only logs an | ||
| # error. | ||
| - name: Score the rules | ||
| continue-on-error: true | ||
| env: | ||
| DECISION_API_URL: ${{ vars.REVIEW_ROUTING_DECISION_API_URL }} | ||
| DECISION_API_KEY: ${{ secrets.REVIEW_ROUTING_DECISION_API_KEY }} | ||
| DECISION_MODEL: ${{ vars.REVIEW_ROUTING_DECISION_MODEL }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| PR_NUMBER: ${{ github.event.number }} | ||
| REPO: ${{ github.repository }} | ||
| run: | | ||
| # `--silent` keeps npm's own header out of the report. | ||
| report="$(npm run --silent --workspace @wordpress/review-routing-tools route -- --pr "$PR_NUMBER" --repo "$REPO")" | ||
| printf '%s\n' "$report" | ||
| printf '%s\n' "$report" >> "$GITHUB_STEP_SUMMARY" | ||
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
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.