Remove some usages of set-output (#35799)

* Migrate straight script usage of set-output to write to GITHUB_OUTPUT
* Use file_put_contents in php scripts to set GITHUB_OUTPUT
This commit is contained in:
Sam Seay 2022-12-06 09:35:49 +13:00 committed by GitHub
parent 2c03d6cc82
commit 43143b848f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 168 additions and 168 deletions

View File

@ -4,16 +4,16 @@ description: Handles the installation, building, and caching of the projects wit
inputs:
install-filters:
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
default: ""
default: ''
build:
description: Indicates whether or not the action should build any projects.
default: "true"
default: 'true'
build-filters:
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
default: ""
default: ''
php-version:
description: The version of PHP that the action should set up.
default: "7.4"
default: '7.4'
runs:
using: composite
@ -22,13 +22,13 @@ runs:
id: parse-input
shell: bash
run: |
echo "::set-output name=INSTALL_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')"
echo "::set-output name=BUILD_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')"
echo "INSTALL_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')" >> $GITHUB_OUTPUT
echo "BUILD_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')" >> $GITHUB_OUTPUT
- name: Setup PNPM
uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d
with:
version: "^7.13.3"
version: '^7.13.3'
- name: Setup Node
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93

View File

@ -40,7 +40,7 @@ jobs:
TOTAL_STR=$(pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --list | grep "Total:")
NO_PREFIX=${TOTAL_STR#*"Total: "}
COUNT=${NO_PREFIX%" tests in"*}
echo "::set-output name=E2E_GRAND_TOTAL::$COUNT"
echo "E2E_GRAND_TOTAL=$COUNT" >> $GITHUB_OUTPUT
- name: Run Playwright E2E tests.
timeout-minutes: 60

View File

@ -24,17 +24,17 @@ jobs:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Set all package string
id: all_description
if: ${{ github.event.inputs.packages == '-a'}}
run: echo "::set-output name=str::all packages"
run: echo "str=all packages" >> $GITHUB_OUTPUT
- name: Set Specific packages string
id: specific_description
if: ${{ github.event.inputs.packages != '-a'}}
run: echo "::set-output name=str::${{ github.event.inputs.packages }}"
run: echo "str=${{ github.event.inputs.packages }}" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4

View File

@ -1,4 +1,4 @@
name: "Release: Generate changelog"
name: 'Release: Generate changelog'
on:
workflow_dispatch:
inputs:
@ -29,56 +29,56 @@ jobs:
with:
build: false
- name: "Git fetch the release branch"
- name: 'Git fetch the release branch'
run: git fetch origin ${{ inputs.releaseBranch }}
- name: "Checkout the release branch"
- name: 'Checkout the release branch'
run: git checkout ${{ inputs.releaseBranch }}
- name: "Create a new branch for the changelog update PR"
- name: 'Create a new branch for the changelog update PR'
run: git checkout -b ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
- name: "Generate the changelog file"
- name: 'Generate the changelog file'
run: pnpm --filter=woocommerce run changelog write --add-pr-num -n -vvv --use-version ${{ inputs.releaseVersion }}
- name: "git rm deleted files"
- name: 'git rm deleted files'
run: git rm $(git ls-files --deleted)
- name: "Commit deletion"
- name: 'Commit deletion'
run: git commit -m "Delete changelog files from ${{ inputs.releaseVersion }} release"
- name: "Remember the deletion commit hash"
- name: 'Remember the deletion commit hash'
id: rev-parse
run: echo "::set-output name=hash::$(git rev-parse HEAD)"
run: echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: "Insert NEXT_CHANGELOG contents into readme.txt"
- name: 'Insert NEXT_CHANGELOG contents into readme.txt'
run: php .github/workflows/scripts/release-changelog.php
- name: "git add readme.txt"
- name: 'git add readme.txt'
run: git add plugins/woocommerce/readme.txt
- name: "Commit readme"
- name: 'Commit readme'
run: git commit -m "Update the readme files for the ${{ inputs.releaseVersion }} release"
- name: "Push update branch to origin"
- name: 'Push update branch to origin'
run: git push origin ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
- name: "Stash any other undesired changes"
- name: 'Stash any other undesired changes'
run: git stash
- name: "Checkout trunk"
- name: 'Checkout trunk'
run: git checkout trunk
- name: "Create a branch for the changelog files deletion"
- name: 'Create a branch for the changelog files deletion'
run: git checkout -b ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
- name: "Cherry-pick the deletion commit"
- name: 'Cherry-pick the deletion commit'
run: git cherry-pick ${{ steps.rev-parse.outputs.hash }}
- name: "Push deletion branch to origin"
- name: 'Push deletion branch to origin'
run: git push origin ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
- name: "Create release branch PR"
- name: 'Create release branch PR'
id: release-pr
uses: actions/github-script@v6
with:
@ -94,7 +94,7 @@ jobs:
return result.data.number;
- name: "Create trunk PR"
- name: 'Create trunk PR'
id: trunk-pr
uses: actions/github-script@v6
with:

View File

@ -49,9 +49,9 @@ jobs:
// If 26 days from now isn't the second Tuesday, then it's not code freeze day.
if ( 'Tuesday' !== $release_day_of_week || $release_day_of_month < 8 || $release_day_of_month > 14 ) {
echo '::set-output name=freeze::1';
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=1\n", FILE_APPEND );
} else {
echo '::set-output name=freeze::0';
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=0\n", FILE_APPEND );
}
maybe-create-next-milestone-and-release-branch: