[release-23.0] CI: scope app tokens to steps instead of exporting via GITHUB_ENV (#20786) - #20797
Conversation
|
Hello @arthurschreiber, there are conflicts in this backport. Please address them in order to merge this Pull Request. You can execute the snippet below to reset your branch and resolve the conflict manually. Make sure you replace |
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
Adds GitHub Actions automation for PR hygiene tasks, performance-benchmark commenting, and syncing generated error-code docs to the website repo, plus a small Codecov flags fix and a new composite action to set up Percona’s APT repo.
Changes:
- Add
pull_request_targetworkflows to comment/label PRs on open and to comment when “Benchmark me” label is applied - Add a
workflow_runpipeline that updates the website repo’s error-code documentation from generated artifacts - Adjust Codecov “partial” flag expression and introduce a composite action to cache/install Percona repo package
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/pr_opened_tasks.yml | New PR-open automation to add checklist comment and initial labels, with label-based skips |
| .github/workflows/error_code_docs_update.yml | New workflow that pulls generated docs artifacts and opens/updates a PR in the website repo |
| .github/workflows/codecov.yml | Tweaks expression used to set Codecov upload flags |
| .github/workflows/arewefastyet_comment.yml | New workflow that comments when “Benchmark me” is applied |
| .github/actions/setup-percona-repo/action.yml | New composite action to cache/download/install Percona repo package |
Suppressed comments (2)
.github/workflows/error_code_docs_update.yml:1
- Passing the entire generated doc block through
awk -v codes=...can be fragile for large artifacts and for content that includes characters/newlines that interact poorly with shell argument passing. Prefer havingawkread from the file directly (or use a safer file-insertion approach) so the workflow doesn’t risk hitting command-size limits or mangling content.
# Updates the website repository with generated error code documentation.
.github/actions/setup-percona-repo/action.yml:1
- The download step doesn’t fail on HTTP errors and doesn’t validate what was downloaded (
curl -sL ...). This can lead to installing a truncated/HTML error response viadpkg -i. Usecurl -f(and ideally--retry/--retry-connrefused) and consider validating the package (checksum/signature) before installing. Also,lsb_releaseis used beforelsb-releaseis installed; install it first or avoid the dependency if the runner image changes.
name: 'Setup Percona Apt Repo'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Generate GitHub App token | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ vars.APP_ID }} | ||
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
| permission-pull-requests: read |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| # Get labels for this pull request | ||
| LABELS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels --jq '.[].name') |
| - name: Generate GitHub App token | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ vars.APP_ID }} | ||
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
| permission-pull-requests: write |
| gh pr edit ${{ github.event.pull_request.number }} \ | ||
| --repo ${{ github.repository }} \ | ||
| --add-label "NeedsWebsiteDocsUpdate,NeedsDescriptionUpdate,NeedsIssue,NeedsBackportReason" |
| name: Add arewefastyet comment | ||
| permissions: | ||
| pull-requests: write |
| - name: Update error documentation | ||
| if: steps.metadata.outputs.skip != 'true' && steps.docs_version.outputs.skip != 'true' | ||
| id: update_docs | ||
| env: | ||
| VERSION: ${{ steps.docs_version.outputs.version }} | ||
| run: | | ||
| DOC_PATH="/tmp/website/content/en/docs/${VERSION}/reference/errors/query-serving.md" |
| !skip { print } | ||
| ' "$DOC_PATH" > /tmp/query-serving-new.md | ||
|
|
||
| mv /tmp/query-serving-new.md "$DOC_PATH" |
| - name: Create or update PR on website | ||
| if: steps.metadata.outputs.skip != 'true' && steps.docs_version.outputs.skip != 'true' && steps.update_docs.outputs.skip != 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| # Check if branch already exists. | ||
| if gh api "repos/${REPO_OWNER}/website/branches/${BRANCH_NAME}" --silent 2>/dev/null; then | ||
| echo "Branch ${BRANCH_NAME} already exists, updating..." | ||
| git fetch origin "${BRANCH_NAME}" | ||
| git checkout "${BRANCH_NAME}" | ||
| git reset --hard origin/prod | ||
| else | ||
| echo "Creating new branch ${BRANCH_NAME}..." | ||
| git checkout -b "${BRANCH_NAME}" | ||
| fi | ||
|
|
||
| # Stage and commit changes. | ||
| git add "$DOC_PATH" | ||
| git commit -m "Updated the query-serving error code" |
| fail_ci_if_error: true | ||
| verbose: true | ||
| flags: ${{ steps.mode.outputs.is_full_run == 'true' && '' || 'partial' }} | ||
| flags: ${{ steps.mode.outputs.is_full_run != 'true' && 'partial' || '' }} |
Only codecov.yml exists on this branch, so the codecov flags fix is all that carries over. Drop the hunks for setup-percona-repo, the arewefastyet comment workflow, the error code docs update workflow and the PR opened tasks workflow: none of them exist here, so the cherry-pick left the versions from main in the tree and would have introduced them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Arthur Schreiber <arthur@planetscale.com>
|
Resolved the conflicts. Of the five paths #20786 touches, only That leaves the codecov flags fix, which is worth having on its own: No conflict markers remain and no Go files change. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Description
This is a backport of #20786