You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shared lib: the changelogger section reader and the phar download - #34
Two helpers move into .github/lib so the release actions share them instead of each carrying a copy: the reader for the changelogger section of package.json, and the phar download.
Changes
lib/changelogger.js: readChangeloggerSection(text) returns the changelogger section, or null when package.json is missing, is not JSON or has no section object, the cases where the changelogger runs on its defaults. release-prep reads its versioning strategy through it.
lib/phar.js: downloadPhar() downloads a phar into the runner's temp directory, reuses it in a later step of the same job, checks an optional sha512 on every call, and deletes the file when the download or the check fails. lib/pup.js downloads pup through it; generate-pot (Add generate-pot: the POT file from WP-CLI, and whether a string changed #25) downloads wp-cli through it.
Tests for both under tests/lib/.
How to test
Run npm test.
Secrets and variables
None.
Summary by CodeRabbit
Chores
Release preparation now handles missing or invalid changelog settings with the semver default.
Downloaded tool files are reused when nonempty, and configured SHA-512 checks apply to both new and reused files. Failed downloads or checksum checks remove the file and report an error.
Tests
Added coverage for changelog settings, download reuse, checksum failures, and download errors.
No actionable comments were generated in the recent review.
Walkthrough
The release-prep action now uses a shared parser for changelogger configuration. PHAR existence checks, downloads, retries, checksum validation, and cleanup move into a shared helper. The pup module delegates to that helper. Tests cover parser inputs and PHAR reuse and failures.
Changes: Changelogger Section Parsing
Layer / File(s)
Summary
Parse and use the changelogger section .github/lib/changelogger.js, .github/actions/release-prep/release-prep.js, tests/lib/changelogger.test.js
Adds a shared parser that returns a valid changelogger object or null. The release-prep action uses it to select the versioning strategy. Tests cover valid, absent, invalid, and unsupported section values.
PHAR Download Handling
Layer / File(s)
Summary
Implement and test PHAR handling .github/lib/phar.js, tests/lib/phar.test.js
Adds shared checks for nonempty PHAR files and download handling with retries. The helper verifies nonempty SHA-512 values for reused and new files and removes files after download or checksum errors. Tests cover reuse and failures.
Delegate pup downloads to the shared helper .github/lib/pup.js
Replaces local PHAR checks and download logic with calls to the shared helper. Removes the local pharExists export.
The change moves shared release helpers into a common library and keeps their behavior the same. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names two real changes in the PR: the new shared changelogger section reader (readChangeloggerSection) and the shared phar download helper (downloadPhar). Both are present in the summary and…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names two real changes in the PR: the new shared changelogger section reader (readChangeloggerSection) and the shared phar download helper (downloadPhar). Both are present in the summary and objectives. The title is specific and accurate, though it is a fragment rather than a full sentence and does not state why the code moved into a shared library.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Enterprise
Run ID: 443bd769-6c2d-4ced-87f9-5bf1f2cce544
Commits
Reviewing files that changed from the base of the PR and between 2a409f7 and 55d2c1e.
Files selected for processing: 6
.github/actions/release-prep/release-prep.js
.github/lib/changelogger.js
.github/lib/phar.js
.github/lib/pup.js
tests/lib/changelogger.test.js
tests/lib/phar.test.js
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 6 remain after this review.
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
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.
Summary
Two helpers move into
.github/libso the release actions share them instead of each carrying a copy: the reader for thechangeloggersection ofpackage.json, and the phar download.Changes
lib/changelogger.js:readChangeloggerSection(text)returns thechangeloggersection, or null whenpackage.jsonis missing, is not JSON or has no section object, the cases where the changelogger runs on its defaults.release-prepreads its versioning strategy through it.lib/phar.js:downloadPhar()downloads a phar into the runner's temp directory, reuses it in a later step of the same job, checks an optional sha512 on every call, and deletes the file when the download or the check fails.lib/pup.jsdownloads pup through it;generate-pot(Add generate-pot: the POT file from WP-CLI, and whether a string changed #25) downloads wp-cli through it.tests/lib/.How to test
npm test.Secrets and variables
None.
Summary by CodeRabbit
Chores
Tests