Skip to content

Commit

Permalink
Merge branch 'trunk' into update/108-nodejs-v20
Browse files Browse the repository at this point in the history
  • Loading branch information
eason9487 committed May 16, 2024
2 parents d746fe5 + eec0ff5 commit f2d5c09
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/github-actions-create-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
install-deps: "no"

- name: Create and commit test build
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
BRANCH_NAME="${{ github.ref_name }}"
TEST_BRANCH_NAME="${BRANCH_NAME}-test-build"
.github/scripts/github-actions-create-and-commit-build.sh "$REPO_URL" "$BRANCH_NAME"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/github-actions-delete-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
ref: trunk

- name: Delete test build branch
env:
BRANCH_NAME: ${{ format('{0}-test-build', github.event.ref) }}
run: |
BRANCH_NAME="${{ github.event.ref }}-test-build"
REMOTE_BRANCH_NAME="origin/${BRANCH_NAME}"
git fetch --prune --no-tags --depth=1 origin
Expand Down
6 changes: 6 additions & 0 deletions packages/github-actions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2024-05-16 (1.11.4)
### Bug Fixes 🐛
* Avoid running malicious inputs as shell commands in Custom GitHub actions and relate workflows. (https://github.com/woocommerce/grow/pull/131)
### Tweaked 🔧
* Remove the unused step `id` from the `run-qit-extension` action. (https://github.com/woocommerce/grow/pull/130)

## 2024-05-13 (1.11.3)
### Tweaked 🔧
* Update QIT test types `api` and `e2e` for the `run-qit-extension` action to align with the renamed types. (https://github.com/woocommerce/grow/pull/127)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ runs:
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' }}
# Use the github-actions bot account to commit.
# https://api.github.com/users/github-actions%5Bbot%5D
env:
HEAD_REF: ${{ github.head_ref }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git fetch origin develop trunk --unshallow --no-tags
git checkout develop
git merge --no-ff origin/trunk -m "Automerge ${{ github.head_ref }} from trunk to develop"
git merge --no-ff origin/trunk -m "Automerge ${HEAD_REF} from trunk to develop"
git push
3 changes: 2 additions & 1 deletion packages/github-actions/actions/eslint-annotation/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ runs:
steps:
# Copy formatter script to the destination file path.
- shell: bash
env:
SCRIPT_DEST: ${{ inputs.formatter-dest }}
run: |
SCRIPT_DEST="${{ inputs.formatter-dest }}"
mkdir -p $(dirname "$SCRIPT_DEST")
echo '/* eslint-disable */' > "$SCRIPT_DEST"
cat "${{ github.action_path }}/eslintFormatter.cjs" >> "$SCRIPT_DEST"
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ runs:
uses: actions/github-script@v7
with:
script: |
const title = '${{github.event.pull_request.title}} - Merge `trunk` to `develop`';
const title = `${ context.payload.pull_request.title } - Merge \`trunk\` to \`develop\``;
const opts = await github.rest.pulls.create( {
...context.repo,
base: 'develop',
head: 'trunk',
title,
body: '${{ github.event.pull_request.html_url }}',
body: context.payload.pull_request.html_url,
} );
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,25 @@ runs:
steps:
- name: Set release branch name
id: release-vars
env:
INPUT_TYPE: ${{ inputs.type }}
INPUT_VERSION: ${{ inputs.version }}
shell: bash
run: echo "branch=${{ inputs.type }}/${{ inputs.version }}" >> $GITHUB_OUTPUT
run: echo "branch=${INPUT_TYPE}/${INPUT_VERSION}" >> $GITHUB_OUTPUT

- name: Prepare release commits
env:
BRANCH_NAME: ${{ steps.release-vars.outputs.branch }}
shell: bash
# Use the github-actions bot account to commit.
# https://api.github.com/users/github-actions%5Bbot%5D
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b ${{ steps.release-vars.outputs.branch }}
git checkout -b "${BRANCH_NAME}"
git commit --allow-empty -q -m "Start \`${{ steps.release-vars.outputs.branch }}\`."
git push --set-upstream origin ${{ steps.release-vars.outputs.branch }}
git commit --allow-empty -q -m "Start \`${BRANCH_NAME}\`."
git push --set-upstream origin "${BRANCH_NAME}"
- name: Create a pull request for the release
id: prepare-release-pr
uses: actions/github-script@v7
Expand All @@ -64,11 +69,9 @@ runs:
context,
github,
inputs,
refName: '${{ steps.release-vars.outputs.branch }}'
refName: `${ inputs.type }/${ inputs.version }`,
} );
- name: Generate summary
shell: bash
run: |
echo "Release PR created at ${{ fromJSON(steps.prepare-release-pr.outputs.result).html_url }}" >> $GITHUB_STEP_SUMMARY
6 changes: 3 additions & 3 deletions packages/github-actions/actions/prepare-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ runs:
# Install node dependencies.
- shell: bash
env:
INSTALL_DEPS: ${{ inputs.install-deps }}
IGNORE_SCRIPTS: ${{ inputs.ignore-scripts }}
# `actions/setup-node` should update npm cache directory if `package-lock` has changed.
run: |
INSTALL_DEPS="${{ inputs.install-deps }}"
IGNORE_SCRIPTS="${{ inputs.ignore-scripts }}"
COLOR_INFO="\033[38;5;39m"
COLOR_END="\033[0m"
Expand Down
3 changes: 2 additions & 1 deletion packages/github-actions/actions/prepare-php/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ runs:

# Install Composer dependencies.
- shell: bash
env:
INSTALL_DEPS: ${{ inputs.install-deps }}
run: |
INSTALL_DEPS="${{ inputs.install-deps }}"
COMPOSER_VER=$(composer --version | awk '{ print $3 }')
COLOR_INFO="\033[38;5;39m"
Expand Down
13 changes: 9 additions & 4 deletions packages/github-actions/actions/run-qit-annotate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ runs:
zip: ${{ inputs.extension-file && format('--zip={0}', inputs.extension-file) || '' }}
wait: ${{ inputs.wait == 'true' && '--wait' || '' }}
ignore_fail: ${{ inputs.ignore-fail == 'true' && '--ignore-fail' || '' }}
type: ${{ inputs.type }}
extension: ${{ inputs.extension }}
options: ${{ inputs.options }}
run: |
json=`./vendor/bin/qit run:${{ inputs.type }} \
${{ inputs.extension }} \
json=`./vendor/bin/qit run:${type} \
${extension} \
$zip \
${{ inputs.options }} \
${options} \
$wait \
$ignore_fail \
-n \
Expand All @@ -85,8 +88,10 @@ runs:
# Annotate the results according to the status, forward qit exit code.
- name: Annotate and exit
shell: bash
env:
type: ${{ inputs.type }}
run: |
summary="${{ inputs.type }} (${{ steps.read-summary.outputs.test_run_id }}): ${{ steps.read-summary.outputs.status }} - ${{ steps.read-summary.outputs.summary }} \`qit get ${{ steps.read-summary.outputs.test_run_id }}\`";
summary="${type} (${{ steps.read-summary.outputs.test_run_id }}): ${{ steps.read-summary.outputs.status }} - ${{ steps.read-summary.outputs.summary }} \`qit get ${{ steps.read-summary.outputs.test_run_id }}\`";
case ${{ steps.read-summary.outputs.status }} in
"success") echo "::notice ::$summary"
;;
Expand Down
5 changes: 0 additions & 5 deletions packages/github-actions/actions/run-qit-extension/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ runs:
--qit_token='${{ inputs.qit-partner-secret }}'
- name: Activation test
id: activation
if: ${{ inputs.test-activation == 'true' }}
uses: woocommerce/grow/run-qit-annotate@actions-v2
with:
Expand All @@ -103,7 +102,6 @@ runs:
options: ${{ inputs.options }}

- name: Security test
id: security
if: ${{ inputs.test-security == 'true' }}
uses: woocommerce/grow/run-qit-annotate@actions-v2
with:
Expand All @@ -115,7 +113,6 @@ runs:
options: ${{ inputs.options }}

- name: PHPStan test
id: phpstan
if: ${{ inputs.test-phpstan == 'true' }}
uses: woocommerce/grow/run-qit-annotate@actions-v2
with:
Expand All @@ -127,7 +124,6 @@ runs:
options: ${{ inputs.options }}

- name: API test
id: api
if: ${{ inputs.test-api == 'true' }}
uses: woocommerce/grow/run-qit-annotate@actions-v2
with:
Expand All @@ -139,7 +135,6 @@ runs:
options: ${{ inputs.options }}

- name: E2E test
id: e2e
if: ${{ inputs.test-e2e == 'true' }}
uses: woocommerce/grow/run-qit-annotate@actions-v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ runs:
steps:
# Copy formatter script to the destination file path.
- shell: bash
env:
SCRIPT_DEST: ${{ inputs.formatter-dest }}
run: |
SCRIPT_DEST="${{ inputs.formatter-dest }}"
mkdir -p $(dirname "$SCRIPT_DEST")
echo '/* eslint-disable */' > "$SCRIPT_DEST"
cat "${{ github.action_path }}/stylelintFormatter.cjs" >> "$SCRIPT_DEST"
4 changes: 2 additions & 2 deletions packages/github-actions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/github-actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-grow-github-actions",
"version": "1.11.3",
"version": "1.11.4",
"description": "GitHub JavaScript actions for a WooCommerce plugin repo by Grow Team.",
"type": "module",
"scripts": {
Expand Down

0 comments on commit f2d5c09

Please sign in to comment.