From deb6e3cef7c909c264941ae523d4588f717f19d2 Mon Sep 17 00:00:00 2001 From: thelovekesh Date: Wed, 23 Nov 2022 13:00:49 +0530 Subject: [PATCH] Update deprecated set-output commands with GITHUB_OUTPUT environment files --- .github/workflows/build-test-measure.yml | 31 +++++++++---------- .../workflows/gutenberg-packages-update.yml | 16 +++++----- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index 024f1dc062a..b55afa81a4e 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -71,11 +71,11 @@ jobs: echo "Changed JS file count: $JS_FILE_COUNT" echo "Changed GHA workflow file count: $GHA_WORKFLOW_COUNT" - echo "::set-output name=count::$FILE_COUNT" - echo "::set-output name=php-count::$PHP_FILE_COUNT" - echo "::set-output name=css-count::$CSS_FILE_COUNT" - echo "::set-output name=js-count::$JS_FILE_COUNT" - echo "::set-output name=gha-workflow-count::$GHA_WORKFLOW_COUNT" + echo "count=$FILE_COUNT" >> $GITHUB_OUTPUT + echo "php-count=$PHP_FILE_COUNT" >> $GITHUB_OUTPUT + echo "css-count=$CSS_FILE_COUNT" >> $GITHUB_OUTPUT + echo "js-count=$JS_FILE_COUNT" >> $GITHUB_OUTPUT + echo "gha-workflow-count=$GHA_WORKFLOW_COUNT" >> $GITHUB_OUTPUT env: # Ignore Paths: # - .github/ @@ -176,7 +176,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -222,7 +222,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -304,7 +304,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -457,7 +457,7 @@ jobs: - name: Get Composer Cache Directory if: needs.pre-run.outputs.changed-php-count > 0 id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache if: needs.pre-run.outputs.changed-php-count > 0 @@ -590,7 +590,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -710,7 +710,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -810,8 +810,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Configure Composer cache uses: actions/cache@v3.0.11 @@ -843,11 +842,11 @@ jobs: - name: Retrieve branch name id: retrieve-branch-name - run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" + run: echo "branch_name=$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_OUTPUT - name: Retrieve git SHA-8 string id: retrieve-git-sha-8 - run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - name: Upload build as artifact uses: actions/upload-artifact@v3 @@ -916,7 +915,7 @@ jobs: - Download [development build](https://storage.googleapis.com/ampwp_github_artifacts/${{ github.ref }}/dev/amp.zip?${{ github.sha }}) - Download [production build](https://storage.googleapis.com/ampwp_github_artifacts/${{ github.ref }}/prod/amp.zip?${{ github.sha }})" body="${body//$'\n'/'%0A'}" - echo "::set-output name=body::$body" + echo "body=$body" >> $GITHUB_OUTPUT - name: Create comment on PR with links to plugin builds if: ${{ steps.find-comment.outputs.comment-id == '' }} diff --git a/.github/workflows/gutenberg-packages-update.yml b/.github/workflows/gutenberg-packages-update.yml index 1047af3596f..634dfc5795d 100644 --- a/.github/workflows/gutenberg-packages-update.yml +++ b/.github/workflows/gutenberg-packages-update.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Get latest release version id: latest-release - run: echo "::set-output name=version::$(gh api -X GET repos/wordpress/gutenberg/releases/latest --jq '.name')" + run: echo "version=$(gh api -X GET repos/wordpress/gutenberg/releases/latest --jq '.name')" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -40,7 +40,7 @@ jobs: if ! egrep -q '^[0-9][0-9]*(\.[0-9][0-9]*)*$' <<< "$LAST_VERSION"; then LAST_VERSION='0.0.0' fi - echo "::set-output name=version::$(echo "$LAST_VERSION")" + echo "version=$(echo "$LAST_VERSION")" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} QUERY: 'repo:ampproject/amp-wp is:pr author:app/github-actions is:merged in:title Update Gutenberg packages after' @@ -50,7 +50,7 @@ jobs: run: | echo "Last version: $LAST_VER" echo "Latest version: $LATEST_VER" - echo "::set-output name=outdated::$(php -r 'echo json_encode(version_compare($argv[1], $argv[2], ">"));' "$LATEST_VER" "$LAST_VER")" + echo "outdated=$(php -r 'echo json_encode(version_compare($argv[1], $argv[2], ">"));' "$LATEST_VER" "$LAST_VER")" >> $GITHUB_OUTPUT env: LAST_VER: ${{ steps.last-release.outputs.version }} LATEST_VER: ${{ steps.latest-release.outputs.version }} @@ -66,7 +66,7 @@ jobs: id: latest-pr run: | PR_NUM=$(gh api -X GET search/issues -f q='${{ env.QUERY }}' -f sort='created' -f order='desc' --jq '.items.[0].number') - echo "::set-output name=num::$(echo $PR_NUM)" + echo "num=$(echo $PR_NUM)" >> $GITHUB_OUTPUT echo "Latest PR number: ${PR_NUM}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -100,8 +100,8 @@ jobs: - name: Determine branch name id: branches run: | - echo "::set-output name=base::$(echo ${GITHUB_REF#refs/heads/})" - echo "::set-output name=head::$(echo "update/gutenberg-v$VERSION-packages")" + echo "base=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + echo "head=$(echo "update/gutenberg-v$VERSION-packages")" >> $GITHUB_OUTPUT env: VERSION: ${{ needs.check-gutenberg-release.outputs.latest-version }} @@ -118,7 +118,7 @@ jobs: - name: Check if remote branch exists id: remote-branch - run: echo ::set-output name=exists::$([[ -z $(git ls-remote --heads origin "$HEAD_BRANCH" ) ]] && echo "0" || echo "1") + run: echo "exists=$([[ -z $(git ls-remote --heads origin "$HEAD_BRANCH" ) ]] && echo "0" || echo "1")" >> $GITHUB_OUTPUT env: HEAD_BRANCH: ${{ steps.branches.outputs.head }} @@ -147,7 +147,7 @@ jobs: run: | # Get list of latest package versions. PACKAGES=$(npm outdated --parseable | cut -d':' -f 4 | grep @wordpress | paste -s -d' ' || echo 0) - echo "::set-output name=list::$(echo "$PACKAGES")" + echo "list=$(echo "$PACKAGES")" >> $GITHUB_OUTPUT - name: Update packages if: steps.packages.outputs.list != 0