Skip to content

[release-23.0] CI: scope app tokens to steps instead of exporting via GITHUB_ENV (#20786) - #20797

Merged
arthurschreiber merged 2 commits into
release-23.0from
backport-20786-to-release-23.0
Aug 5, 2026
Merged

[release-23.0] CI: scope app tokens to steps instead of exporting via GITHUB_ENV (#20786)#20797
arthurschreiber merged 2 commits into
release-23.0from
backport-20786-to-release-23.0

Conversation

@vitess-bot

@vitess-bot vitess-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

This is a backport of #20786

Copilot AI balanced review requested due to automatic review settings August 4, 2026 18:06
@vitess-bot vitess-bot Bot added Component: Build/CI Backport This is a backport Skip CI Skip CI actions from running Merge Conflict Type: Security labels Aug 4, 2026
@vitess-bot

vitess-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

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 origin by the name of the vitessio/vitess remote

git fetch --all
gh pr checkout 20797
git reset --hard origin/release-23.0
git cherry-pick -m 1 76ebfa4096192d575f3bbfdd2ae491b96dc5f9a6

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_target workflows to comment/label PRs on open and to comment when “Benchmark me” label is applied
  • Add a workflow_run pipeline 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 having awk read 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 via dpkg -i. Use curl -f (and ideally --retry/--retry-connrefused) and consider validating the package (checksum/signature) before installing. Also, lsb_release is used before lsb-release is 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.

Comment thread .github/workflows/pr_opened_tasks.yml Outdated
Comment on lines +27 to +33
- 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
Comment thread .github/workflows/pr_opened_tasks.yml Outdated
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')
Comment thread .github/workflows/pr_opened_tasks.yml Outdated
Comment on lines +89 to +95
- 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
Comment thread .github/workflows/pr_opened_tasks.yml Outdated
Comment on lines +101 to +103
gh pr edit ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--add-label "NeedsWebsiteDocsUpdate,NeedsDescriptionUpdate,NeedsIssue,NeedsBackportReason"
Comment on lines +12 to +14
name: Add arewefastyet comment
permissions:
pull-requests: write
Comment on lines +88 to +94
- 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"
Comment on lines +142 to +145
- 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 }}
Comment on lines +155 to +168
# 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' || '' }}
@github-actions github-actions Bot added this to the v23.0.6 milestone Aug 4, 2026
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>
@arthurschreiber arthurschreiber removed Skip CI Skip CI actions from running Merge Conflict labels Aug 4, 2026
Copilot AI review requested due to automatic review settings August 4, 2026 18:12
@arthurschreiber

Copy link
Copy Markdown
Member

Resolved the conflicts.

Of the five paths #20786 touches, only codecov.yml exists on release-23.0 — setup-percona-repo, arewefastyet_comment.yml, error_code_docs_update.yml and pr_opened_tasks.yml are all absent here. The cherry-pick left main's versions in the tree for those and the bot committed them, so as created this PR would have introduced four files this branch never had. I dropped them.

That leaves the codecov flags fix, which is worth having on its own: is_full_run == 'true' && '' || 'partial' always evaluated to 'partial', because the true-arm '' is falsy and the || fell through. Inverting the condition makes the ternary sound, so scheduled full runs upload unflagged as intended.

No conflict markers remain and no Go files change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@arthurschreiber
arthurschreiber marked this pull request as ready for review August 5, 2026 11:37
@arthurschreiber
arthurschreiber enabled auto-merge (squash) August 5, 2026 11:37
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@arthurschreiber
arthurschreiber merged commit 23d9932 into release-23.0 Aug 5, 2026
108 checks passed
@arthurschreiber
arthurschreiber deleted the backport-20786-to-release-23.0 branch August 5, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants