Skip to content

[ci] Enabled changelog bot from openwisp-utils#1352

Merged
nemesifier merged 2 commits intoopenwisp:masterfrom
pushpitkamboj:ci/changelog_bot
May 8, 2026
Merged

[ci] Enabled changelog bot from openwisp-utils#1352
nemesifier merged 2 commits intoopenwisp:masterfrom
pushpitkamboj:ci/changelog_bot

Conversation

@pushpitkamboj
Copy link
Copy Markdown
Contributor

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #1271

Description of Changes

Added a changelog bot workflow to automatically update changelogs when PRs are approved.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces two complementary GitHub Actions workflows to automate changelog generation for the OpenWISP Controller repository. The trigger workflow (bot-changelog-trigger.yml) monitors pull request reviews, activates only when approved by authorized team members, and conditionally uploads PR metadata when the title matches predefined changelog categories ([feature], [fix], or [change]). The runner workflow (bot-changelog-runner.yml) consumes the uploaded artifact, validates the PR number, and delegates changelog generation to a shared reusable workflow (openwisp/openwisp-utils) while supplying Gemini and bot credentials with appropriate pull request and issue write permissions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Both workflows implement the changelog bot integration objective defined in #1271.

Suggested reviewers

  • nemesifier
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows the required [type] format with 'ci' as the type and provides a descriptive summary of enabling the changelog bot from openwisp-utils.
Description check ✅ Passed The PR description covers the checklist partially, references the linked issue #1271, and provides a clear description of changes, though test cases and documentation updates are not marked as completed.
Linked Issues check ✅ Passed The PR implementation adds two GitHub workflows that together fulfill the objective of automating changelog generation when PRs are approved, as specified in issue #1271.
Out of Scope Changes check ✅ Passed All changes in the PR (two new workflow files) are directly related to implementing the changelog bot automation requested in issue #1271, with no out-of-scope modifications.
Bug Fixes ✅ Passed This PR adds a new changelog bot workflow feature, not a bug fix. The custom check is inapplicable. GitHub Actions workflow changes have a documented exception.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot Bot commented May 8, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The changelog bot workflow implementation looks good. The PR number validation in bot-changelog-runner.yml properly sanitizes input before passing to the reusable workflow, and the conditional logic for artifact handling is robust.

Files Reviewed (2 files)
  • .github/workflows/bot-changelog-runner.yml - Downloads PR metadata and calls reusable changelog workflow
  • .github/workflows/bot-changelog-trigger.yml - Triggers on PR approval and uploads metadata for noteworthy PRs

Reviewed by kimi-k2.5-0127 · 82,864 tokens

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/bot-changelog-trigger.yml:
- Around line 33-38: The Upload PR metadata step uses actions/upload-artifact@v7
and currently writes an artifact named changelog-metadata without allowing
overwrites; update the step (the "Upload PR metadata" job using
actions/upload-artifact@v7) to include overwrite: true under the with block so
repeated runs or re-approvals can replace the existing changelog-metadata
artifact without failing.
- Around line 13-15: Update the conditional that checks
github.event.review.author_association to remove the 'COLLABORATOR' branch so
only 'OWNER' and 'MEMBER' are allowed; specifically edit the expression that
currently tests (github.event.review.author_association == 'OWNER' ||
github.event.review.author_association == 'MEMBER' ||
github.event.review.author_association == 'COLLABORATOR') to drop the
COLLABORATOR comparison so it becomes only OWNER or MEMBER, ensuring the
workflow trigger aligns with the repo policy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c7520ad8-2105-4aa4-9428-233146265c9d

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab018d and 22f78c5.

📒 Files selected for processing (2)
  • .github/workflows/bot-changelog-runner.yml
  • .github/workflows/bot-changelog-trigger.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Python==3.10 | django~=4.2.0
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.12 | django~=4.2.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Kilo Code Review
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-02-24T16:24:55.443Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:22-22
Timestamp: 2026-02-24T16:24:55.443Z
Learning: In repositories within the OpenWISP organization, it is acceptable to reference reusable workflows from other OpenWISP-controlled repos using mutable refs (e.g., master) in .github/workflows. This is permissible due to the shared trust boundary within the organization. If applying this pattern, ensure the target repos are under the same organization and maintain awareness of potential breakages from upstream mutable refs; consider pinning to a tagged version for longer-term stability when appropriate.

Applied to files:

  • .github/workflows/bot-changelog-runner.yml
  • .github/workflows/bot-changelog-trigger.yml
📚 Learning: 2026-02-24T16:25:20.080Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:35-35
Timestamp: 2026-02-24T16:25:20.080Z
Learning: In .github/workflows/backport.yml, enforce that backport-on-comment triggers only for users with author_association MEMBE R or OWNER (COLLABORATOR excluded), reflecting maintainer feedback. Update the trigger condition to check author_association and restrict to MEMBERS/OWNERS; document rationale and PR `#1233` reference in code comments.

Applied to files:

  • .github/workflows/bot-changelog-runner.yml
  • .github/workflows/bot-changelog-trigger.yml

Comment on lines +13 to +15
(github.event.review.author_association == 'OWNER' ||
github.event.review.author_association == 'MEMBER' ||
github.event.review.author_association == 'COLLABORATOR')
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove COLLABORATOR from the allowed author_association values.

The established policy for this repo (set in PR #1233 for the backport workflow) restricts automated privileged triggers to OWNER and MEMBER only — COLLABORATOR is explicitly excluded per maintainer feedback. Including COLLABORATOR here is inconsistent with that policy and widens the trust boundary beyond what was approved.

🔒 Proposed fix
     if: |
       github.event.review.state == 'approved' &&
       (github.event.review.author_association == 'OWNER' ||
-        github.event.review.author_association == 'MEMBER' ||
-        github.event.review.author_association == 'COLLABORATOR')
+        github.event.review.author_association == 'MEMBER')

Based on learnings: "enforce that backport-on-comment triggers only for users with author_association MEMBER or OWNER (COLLABORATOR excluded), reflecting maintainer feedback."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(github.event.review.author_association == 'OWNER' ||
github.event.review.author_association == 'MEMBER' ||
github.event.review.author_association == 'COLLABORATOR')
(github.event.review.author_association == 'OWNER' ||
github.event.review.author_association == 'MEMBER')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/bot-changelog-trigger.yml around lines 13 - 15, Update the
conditional that checks github.event.review.author_association to remove the
'COLLABORATOR' branch so only 'OWNER' and 'MEMBER' are allowed; specifically
edit the expression that currently tests (github.event.review.author_association
== 'OWNER' || github.event.review.author_association == 'MEMBER' ||
github.event.review.author_association == 'COLLABORATOR') to drop the
COLLABORATOR comparison so it becomes only OWNER or MEMBER, ensuring the
workflow trigger aligns with the repo policy.

Comment on lines +33 to +38
- name: Upload PR metadata
if: steps.check.outputs.has_noteworthy == 'true'
uses: actions/upload-artifact@v7
with:
name: changelog-metadata
path: pr_number
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add overwrite: true to handle re-approvals gracefully.

actions/upload-artifact@v7 defaults to overwrite: false, so if the same PR is dismissed and re-approved (causing a second trigger), the upload step will fail because the artifact changelog-metadata already exists. Add overwrite: true to allow safe re-runs.

🛠️ Proposed fix
       - name: Upload PR metadata
         if: steps.check.outputs.has_noteworthy == 'true'
         uses: actions/upload-artifact@v7
         with:
           name: changelog-metadata
           path: pr_number
+          overwrite: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Upload PR metadata
if: steps.check.outputs.has_noteworthy == 'true'
uses: actions/upload-artifact@v7
with:
name: changelog-metadata
path: pr_number
- name: Upload PR metadata
if: steps.check.outputs.has_noteworthy == 'true'
uses: actions/upload-artifact@v7
with:
name: changelog-metadata
path: pr_number
overwrite: true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/bot-changelog-trigger.yml around lines 33 - 38, The Upload
PR metadata step uses actions/upload-artifact@v7 and currently writes an
artifact named changelog-metadata without allowing overwrites; update the step
(the "Upload PR metadata" job using actions/upload-artifact@v7) to include
overwrite: true under the with block so repeated runs or re-approvals can
replace the existing changelog-metadata artifact without failing.

@openwisp-companion
Copy link
Copy Markdown

Test Failure in test_add_mobile_location

Hello @pushpitkamboj,
(Analysis for commit 22f78c5)

The test test_add_mobile_location in openwisp_controller.geo.tests.test_admin.TestAdmin is failing because it expects one mobile location to be present (AssertionError: 0 != 1), but the count is zero.

Reason:
This indicates that after the test_add_mobile_location function attempts to add a mobile location, the assertion self.location_model.objects.filter(is_mobile=True).count() returns 0, meaning no mobile locations were found. This could be due to a logic error in how the mobile location is added or a setup issue in the test environment.

Fix:
Review the test setup and the logic within test_add_mobile_location to ensure that a mobile location is correctly created and persisted before the assertion is made. If the test logic is correct, investigate the openwisp_controller.geo.tests.test_admin.TestAdmin.test_add_mobile_location method for any potential issues in creating or saving the location object.

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 98.628%. remained the same — pushpitkamboj:ci/changelog_bot into openwisp:master

@nemesifier nemesifier merged commit d0afde0 into openwisp:master May 8, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci] add changelog bot workflow

3 participants