Skip to content

Conversation

@htdat
Copy link
Contributor

@htdat htdat commented Oct 31, 2025

Fixes: WOOPTP-55

Description

  • Add a new script to build the prod zip.
  • Add GitHub workflow to build on the fly.
  • Update and trim down README.md.

Testing instructions

Checklist

  • npm run test:php does not return errors.
  • npm run lint:php does not return errors.

Summary by CodeRabbit

  • Documentation

    • Simplified and restructured product documentation and Quick Start flow, replacing detailed setup and troubleshooting with a concise product-feed overview and WooCommerce settings reference.
  • Chores

    • Added production packaging: local build script, CI workflow to produce a release ZIP artifact, and updated ignore rules to exclude build artifacts.

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Warning

Rate limit exceeded

@htdat has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6724a and 6d05562.

📒 Files selected for processing (2)
  • .github/workflows/build-production-zip.yml (1 hunks)
  • bin/build-prod-zip.sh (1 hunks)

Walkthrough

Adds a GitHub Actions workflow to build a production ZIP, a local build script and npm script to produce that ZIP, updates .gitignore to ignore build artifacts, and replaces detailed README content with a condensed product-feed overview.

Changes

Cohort / File(s) Summary
CI / Build Workflow
/.github/workflows/build-production-zip.yml
New GitHub Actions workflow triggered on pull_request that checks out code, sets up PHP 7.4 and Composer v2, configures a Composer cache, runs the build script, and uploads the produced artifact woocommerce-product-feed-for-openai from build/woocommerce-product-feed-for-woocommerce-product-feed-for-openai with a 7-day retention.
Build Script
bin/build-prod-zip.sh
New Bash script that runs composer install --no-dev --optimize-autoloader with COMPOSER_VENDOR_DIR targeted into the build path, creates build/woocommerce-product-feed-for-openai, copies ./src and ./openai-product-feed-for-woo.php into it, zips the directory to build/woocommerce-product-feed-for-openai.zip, and cleans up the temporary build directory when not running in CI.
Package Script
package.json
Adds a build script entry ("./bin/build-prod-zip.sh") to invoke the new build script.
Ignore Rules
.gitignore
Adds build/ to exclude generated build artifacts from version control.
Documentation
README.md
Replaces prior detailed installation, configuration, mappings, endpoints, and troubleshooting sections with a concise, high-level product-feed description and an abbreviated build/upload quick start.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay extra attention to:
    • bin/build-prod-zip.sh: path handling, Composer vendor dir behavior, files copied into the ZIP, and cleanup logic conditional on CI.
    • /.github/workflows/build-production-zip.yml: triggers, PHP/Composer setup commands, cache key correctness, artifact path and upload configuration.
    • README.md: ensure removed operational instructions were intentionally omitted and essential setup steps remain discoverable.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add script to build prod zip file" accurately describes a core change in the pull request—the addition of the build script in bin/build-prod-zip.sh and the corresponding package.json script entry. The title is clear, concise, and specific enough that a teammate scanning git history would immediately understand that this PR introduces build automation for creating a production ZIP. While the PR also includes a GitHub Actions workflow and README updates, the build script is the foundational component, and the title appropriately highlights it without attempting to enumerate every change.
Description Check ✅ Passed The PR description is mostly complete and follows the repository template structure. The Description section is well-populated with three clear bullet points covering the script addition, GitHub workflow, and README updates. The Checklist section is properly filled with both test items marked as completed, confirming that testing was performed. However, the Testing instructions section is entirely empty, containing only the template placeholder comment with no actual testing guidance provided. Since the description covers the major required sections and the completed checklist demonstrates testing was performed, this constitutes a mostly complete submission despite the missing testing instructions details.

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.

Co-authored-by: Jaclyn Chen <watertranquil@gmail.com>
@htdat htdat marked this pull request as ready for review October 31, 2025 05:58
@htdat htdat self-assigned this Oct 31, 2025
Copy link

@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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 335fb78 and b7175a6.

📒 Files selected for processing (5)
  • .github/workflows/build-production-zip.yml (1 hunks)
  • .gitignore (1 hunks)
  • README.md (1 hunks)
  • bin/build-prod-zip.sh (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-22T06:06:47.231Z
Learnt from: RadoslavGeorgiev
Repo: woocommerce/OpenAI-Product-Feed PR: 13
File: src/Platforms/OpenAI/ProductMapper.php:99-107
Timestamp: 2025-10-22T06:06:47.231Z
Learning: In the woocommerce/OpenAI-Product-Feed repository, exception messages should use escaping functions (like esc_html()) to sanitize translations before throwing, as translations may contain HTML. Do not suggest removing escaping from exception messages in this codebase.

Applied to files:

  • README.md
🪛 actionlint (1.7.8)
.github/workflows/build-production-zip.yml

24-24: shellcheck reported issue in this script: SC2086:info:1:50: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (4)
.gitignore (1)

31-32: LGTM — appropriate to exclude build artifacts.

The addition of build/ aligns with the new build pipeline and prevents generated artifacts from being committed to version control.

bin/build-prod-zip.sh (1)

45-47: LGTM — robust file copying via array.

Using an array for FILES_TO_COPY and iterating with cp -r is maintainable and clear. The array makes it easy to add/remove files in the future.

package.json (1)

13-13: Verify and fix indentation on "build" script entry.

The indentation on line 13 may not match the rest of the file (tabs vs. spaces). Ensure all entries in the scripts section use consistent indentation. Past feedback flagged this as a potential issue—please verify the indentation matches the project's convention.

If using tabs in other parts of the file, update line 13 to use tabs instead of spaces.

.github/workflows/build-production-zip.yml (1)

15-45: LGTM — comprehensive and well-structured CI workflow.

The workflow correctly sets up PHP 7.4, caches Composer dependencies, executes the build script, and uploads the artifact with proper error handling and retention policies. The overall design is solid for a production build pipeline.

htdat and others added 2 commits October 31, 2025 13:16
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@RadoslavGeorgiev RadoslavGeorgiev left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

FYI I've not tested the action, but I assume that the file was mostly carried over from another extension, and it should work.

@htdat
Copy link
Contributor Author

htdat commented Oct 31, 2025

yup, it worked in the last commit https://github.com/woocommerce/OpenAI-Product-Feed/actions/runs/18967534514/job/54167352735 - better link https://github.com/woocommerce/OpenAI-Product-Feed/actions/runs/18967534514?pr=29

I am going to revert the trigger commit and merge it.

@htdat htdat merged commit 31744e0 into trunk Oct 31, 2025
1 check 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.

4 participants