Skip to content

Commit

Permalink
Update deprecated set-output commands with GITHUB_OUTPUT environment …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
thelovekesh committed Nov 23, 2022
1 parent 88fb246 commit deb6e3c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/build-test-measure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 == '' }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/gutenberg-packages-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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'
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down Expand Up @@ -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 }}

Expand All @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit deb6e3c

Please sign in to comment.