-
Notifications
You must be signed in to change notification settings - Fork 42
Create branch-2-playground.yml #3335
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| name: Branch 2 Playground | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Manual only. Pick the branch to build in the "Run workflow" dropdown. | ||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # PLUGIN_SLUG is the WordPress plugin slug ("formidable"), which is not the | ||||||||||||||||||||||||||||||||||||||||||||
| # repo name. It has to match so the ZIP unpacks to wp-content/plugins/formidable | ||||||||||||||||||||||||||||||||||||||||||||
| # the same way the wordpress.org build does. | ||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||
| PLUGIN_SLUG: formidable-forms | ||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Blocking. The comment three lines up has the right value; this line has the repo name. CodeRabbit already flagged the mismatch. Adding the part that makes it a real breakage rather than a naming preference, since I checked it against the plugin's own source rather than against the comment.
$is_addon = 'formidable/formidable.php' !== $this->plugin_folder;Unpack the zip this workflow builds and That is on top of every add-on's own dependency check looking for
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
| ZIP_NAME: formidable.zip | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # One upload at a time, since the object key is fixed and later runs overwrite | ||||||||||||||||||||||||||||||||||||||||||||
| # earlier ones. | ||||||||||||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||||||||||||
| group: branch-2-playground | ||||||||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: false | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||
| build-and-upload: | ||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 1 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # No build step by design. The compiled JS in /js is committed on every | ||||||||||||||||||||||||||||||||||||||||||||
| # update, and the playground blueprint sets SCRIPT_DEBUG so the | ||||||||||||||||||||||||||||||||||||||||||||
| # unminified files are the ones that get loaded. | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Create zip | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| git archive --format=zip --prefix="${PLUGIN_SLUG}/" -o "/tmp/${ZIP_NAME}" HEAD | ||||||||||||||||||||||||||||||||||||||||||||
| ls -lh "/tmp/${ZIP_NAME}" | ||||||||||||||||||||||||||||||||||||||||||||
| unzip -Z -1 "/tmp/${ZIP_NAME}" | head -20 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload to Cloudflare R2 | ||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||
| AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | ||||||||||||||||||||||||||||||||||||||||||||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | ||||||||||||||||||||||||||||||||||||||||||||
| AWS_DEFAULT_REGION: auto | ||||||||||||||||||||||||||||||||||||||||||||
| # R2 rejects the newer AWS CLI default of always sending integrity | ||||||||||||||||||||||||||||||||||||||||||||
| # checksums, so only send them when the API requires it. | ||||||||||||||||||||||||||||||||||||||||||||
| AWS_REQUEST_CHECKSUM_CALCULATION: when_required | ||||||||||||||||||||||||||||||||||||||||||||
| AWS_RESPONSE_CHECKSUM_VALIDATION: when_required | ||||||||||||||||||||||||||||||||||||||||||||
| R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} | ||||||||||||||||||||||||||||||||||||||||||||
| R2_BUCKET: ${{ secrets.R2_BUCKET }} | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| aws s3 cp "/tmp/${ZIP_NAME}" "s3://${R2_BUCKET}/${ZIP_NAME}" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --endpoint-url "https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --content-type application/zip \ | ||||||||||||||||||||||||||||||||||||||||||||
| --cache-control "no-cache, max-age=0" | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not blocking, and worth deciding now rather than after the other plugins are added. The object key is fixed, so every run overwrites the last one and the uploaded zip carries no record of what is in it. The concurrency group stops two runs racing, but it does not stop the second run replacing the first run's build. Once more than one person is pushing branches to the Playground, "which branch is live right now" is only answerable by opening the last workflow run. Two cheap options:
Option 2 is one line and keeps the blueprint as it is. |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Summary | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| echo "### Uploaded to R2" | ||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||
| echo "- **Branch:** \`${{ github.ref_name }}\`" | ||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/branch-2-playground.yml
printf '%s\n' '--- relevant guidance files ---'
git ls-files | rg '(^|/)(CONTRIBUTING|SECURITY|AGENTS|README)(\\.|$)|\\.github/(PULL_REQUEST_TEMPLATE|workflows)' | head -80Repository: Strategy11/formidable-forms Length of output: 3005 🤖 get_repo_knowledge executed:
Length of output: 433 Injection Reachability: External Do not interpolate GitHub expands the expression before Bash parses the script. A branch name containing Proposed fix - name: Summary
+ env:
+ BRANCH_NAME: ${{ github.ref_name }}
run: |
{
echo "### Uploaded to R2"
echo ""
- echo "- **Branch:** \`${{ github.ref_name }}\`"
+ echo "- **Branch:** \`${BRANCH_NAME}\`"🧰 Tools🪛 zizmor (1.29.0)[error] 63-63: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| echo "- **Commit:** \`${{ github.sha }}\`" | ||||||||||||||||||||||||||||||||||||||||||||
| echo "- **Object:** \`${ZIP_NAME}\`" | ||||||||||||||||||||||||||||||||||||||||||||
| } >> "$GITHUB_STEP_SUMMARY" | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirming CodeRabbit's point here, with the bit that decides whether it is theoretical.
Severity is low, because
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Align
PLUGIN_SLUGwith the required plugin directory.The ZIP currently extracts into
formidable-forms/. Lines 7-9 requireformidable/so the Playground can locate the plugin atwp-content/plugins/formidable. SetPLUGIN_SLUGtoformidable, or update the consuming blueprint to useformidable-forms.🤖 Prompt for AI Agents