-
Notifications
You must be signed in to change notification settings - Fork 105
chore: update ci for v2 #793
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
Conversation
WalkthroughAdds branch-targeted Dependabot updates; introduces a v1-specific release draft template; updates the main release draft template; makes Release Drafter select template based on ref; fixes PHP matrix key in two workflows; and adds a target_branch input to update-version workflow to control PR base. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Maintainer
participant GH as GitHub Actions
participant RD as Release Drafter
Dev->>GH: Push/PR on branch
GH->>RD: Run release-drafter with config-name
alt github.ref_name == "v1.x"
Note over GH,RD: Use `release-draft-template-v1.yml`
else
Note over GH,RD: Use `release-draft-template.yml`
end
RD->>GH: Generate/Update release draft
sequenceDiagram
autonumber
actor Op as Operator
participant GH as GitHub Actions
participant Repo as Repository
participant GHCLI as gh CLI
Op->>GH: workflow_dispatch(update-version) with target_branch={main|v1.x}
GH->>Repo: Checkout `ref: ${{ github.event.inputs.target_branch }}` and update files
GH->>Repo: Push NEW_BRANCH
GH->>GHCLI: gh pr create --base ${{ github.event.inputs.target_branch }}
GHCLI-->>Op: PR opened targeting selected base
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/update-version.yml (1)
38-45
: Create branch from the selected target_branch (prevent cross-branch diffs)Checkout the chosen target_branch before editing/committing so the created branch is based on it; also explicitly set the PR head.
File: .github/workflows/update-version.yml — checkout step (line 27) and PR creation step (lines ~38–45)- - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.target_branch }}gh pr create \ --title "Update version for the next release ($NEW_VERSION)" \ --body '⚠️ This PR is automatically generated. Check the new version is the expected one.' \ --label 'skip-changelog' \ - --base ${{ github.event.inputs.target_branch }} + --base ${{ github.event.inputs.target_branch }} \ + --head ${{ env.NEW_BRANCH }}
🧹 Nitpick comments (6)
.github/release-draft-template-v1.yml (2)
22-25
: Use "labels" when providing multiple labels in categories.Release Drafter expects "labels" (plural) for arrays; using "label" with a list may be ignored.
Apply this diff:
- - title: "⚙️ Maintenance/misc" - label: - - "maintenance" - - "documentation" + - title: "⚙️ Maintenance/misc" + labels: + - "maintenance" + - "documentation"
38-38
: Consider descending sort for changelog readability.Most projects list newest first. Optional: switch to "descending".
-sort-direction: "ascending" +sort-direction: "descending".github/workflows/update-version.yml (1)
9-15
: Inputs look good; consider defaulting target_branch.Optional: set a default (e.g., main) to speed dispatch.
target_branch: description: 'Target branch for the version update' required: true type: choice options: - main - v1.x + default: main
.github/release-draft-template.yml (1)
24-27
: Use "labels" for multiple category labels.Same schema concern as the v1 template.
- - title: "⚙️ Maintenance/misc" - label: - - "maintenance" - - "documentation" + - title: "⚙️ Maintenance/misc" + labels: + - "maintenance" + - "documentation".github/dependabot.yml (2)
25-37
: Composer (main) block looks good; add timezone for deterministic run time.Dependabot times default to UTC. Add timezone if you prefer a specific local time.
schedule: interval: "monthly" time: "04:00" + timezone: "UTC"
38-50
: Composer (v1.x) block mirrors main; same timezone suggestion.Keeps the flows symmetrical.
schedule: interval: "monthly" time: "04:00" + timezone: "UTC"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.github/dependabot.yml
(1 hunks).github/release-draft-template-v1.yml
(1 hunks).github/release-draft-template.yml
(1 hunks).github/workflows/meilisearch-beta-tests.yml
(1 hunks).github/workflows/pre-release-tests.yml
(2 hunks).github/workflows/release-drafter.yml
(1 hunks).github/workflows/update-version.yml
(2 hunks)
🔇 Additional comments (6)
.github/workflows/meilisearch-beta-tests.yml (1)
50-50
: Matrix key fix looks correct.Using matrix.php-version matches the defined strategy key. No further issues.
Please confirm setup-php@v2 supports PHP 8.4 on ubuntu-latest in your runners.
.github/workflows/pre-release-tests.yml (2)
30-30
: Job name variable fix LGTM.Switching to matrix.php-version aligns with the matrix key.
50-50
: Install PHP step fix LGTM.php-version now correctly references matrix.php-version.
Confirm that all configured PHP versions (including 8.4) are available in shivammathur/setup-php@v2.
.github/release-draft-template.yml (1)
13-14
: Version template note.If this repo already has v2 tags, a fixed "2.0.0" may be unnecessary; otherwise fine as an initial seed. No action if intentional.
.github/workflows/release-drafter.yml (1)
15-15
: Dynamic template selection LGTM.Conditional config-name for v1.x vs default is valid.
Ensure both template files exist at .github/ and that release-drafter@v6 reads config-name from that path.
.github/dependabot.yml (1)
3-24
: Per-branch GitHub Actions updates LGTM.Explicit target-branch for main and v1.x is clear.
Confirm that "time" is honored for monthly schedules by Dependabot; if not, consider weekly with time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/update-version.yml (1)
3-5
: Set explicit workflow permissions for reliability.Be explicit to avoid org defaults breaking pushes/PR edits, especially when mixing GITHUB_TOKEN and a PAT.
Apply near the top (after name:):
name: Update library version + +permissions: + contents: write + pull-requests: write
🧹 Nitpick comments (5)
.github/workflows/update-version.yml (5)
9-15
: Input looks good; consider a default for UX and keep options in sync.Adding target_branch is correct. Consider setting a default (e.g., main) to reduce manual errors, and ensure this list stays aligned with actual long‑lived branches and Release Drafter logic.
Would you like a quick script to verify that both main and v1.x exist on the remote and that Release Drafter selects the right template for each?
28-29
: Checkout by ref is correct; add fetch-depth and disable persisted creds.To avoid shallow‑clone surprises and to prevent mixing checkout creds with the bot PAT later, add fetch-depth: 0 and persist-credentials: false.
Apply:
- - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.target_branch }} + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.target_branch }} + fetch-depth: 0 + persist-credentials: false
35-39
: Ensure pushes use the bot PAT for consistency and protected branches.EndBug/add-and-commit defaults to GITHUB_TOKEN. If branch protections or cross‑branch pushes require the bot PAT, pass it explicitly so the author/actor is consistent across main and v1.x.
Apply:
- name: Commit and push the changes to the ${{ env.NEW_BRANCH }} branch uses: EndBug/add-and-commit@v9 with: message: "Update version for the next release (${{ env.NEW_VERSION }}) in Meilisearch.php" new_branch: ${{ env.NEW_BRANCH }} + token: ${{ secrets.MEILI_BOT_GH_PAT }}
46-47
: Make PR creation idempotent to avoid failures on re-runs.gh pr create will fail if a PR from the same head already exists (e.g., re‑runs). Guard it by checking for an existing PR and editing/updating as needed.
Apply:
- gh pr create \ - --title "Update version for the next release ($NEW_VERSION)" \ - --body '⚠️ This PR is automatically generated. Check the new version is the expected one.' \ - --label 'skip-changelog' \ - --base ${{ github.event.inputs.target_branch }} \ - --head ${{ env.NEW_BRANCH }} + existing_pr=$(gh pr list --head "${NEW_BRANCH}" --state open --json number --jq '.[0].number') + if [ -n "$existing_pr" ]; then + gh pr edit "$existing_pr" \ + --base "${{ github.event.inputs.target_branch }}" \ + --title "Update version for the next release ($NEW_VERSION)" \ + --add-label 'skip-changelog' \ + --body '⚠️ This PR is automatically updated. Check the new version is the expected one.' + else + gh pr create \ + --title "Update version for the next release ($NEW_VERSION)" \ + --body '⚠️ This PR is automatically generated. Check the new version is the expected one.' \ + --label 'skip-changelog' \ + --base "${{ github.event.inputs.target_branch }}" \ + --head "${{ env.NEW_BRANCH }}" + fi
31-35
: Optional: validate input format before mutating files.Guard against a missing leading v to avoid writing an invalid VERSION.
Apply:
run: | - raw_new_version=$(echo $NEW_VERSION | cut -d 'v' -f 2) + if ! echo "$NEW_VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "NEW_VERSION must follow vX.Y.Z (got: $NEW_VERSION)"; exit 1; + fi + raw_new_version="${NEW_VERSION#v}" new_string="VERSION = '$raw_new_version';" sed -i "s/VERSION = .*/$new_string/" src/Meilisearch.php
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/update-version.yml
(3 hunks)
🔇 Additional comments (1)
.github/workflows/update-version.yml (1)
40-40
: Rename is accurate and improves clarity.
Pull Request
Related issue
Prepare for #749
What does this PR do?
Update CI configuration to handle both
main
andv1.x
branches:update_release_draft
jobupdate-version
jobdependabot.yml
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit
Chores
Bug Fixes