Migrate workflows from deprecated set-output commands

GitHub Actions provides the capability for workflow authors to use the capabilities of the GitHub Actions ToolKit
package directly in the `run` keys of workflows via "workflow commands". One such command is `set-output`, which allows
data to be passed out of a workflow step as an output.

It has been determined that this command has potential to be a security risk in some applications. For this reason,
GitHub has deprecated the command and a warning of this is shown in the workflow run summary page of any workflow using
it:

The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more
information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

The identical capability is now provided in a safer form via the GitHub Actions "environment files" system. Migrating
the use of the deprecated workflow commands to use the `GITHUB_OUTPUT` environment file instead fixes any potential
vulnerabilities in the workflows, resolves the warnings, and avoids the eventual complete breakage of the workflows that
would result from GitHub's planned removal of the `set-output` workflow command 2023-05-31.
This commit is contained in:
per1234 2022-10-30 17:01:04 -07:00
parent b998d35524
commit 8a85b5c3d8
4 changed files with 5 additions and 5 deletions

View File

@ -183,7 +183,7 @@ jobs:
OUTPUT_SAFE_BODY="${BODY//'%'/'%25'}" OUTPUT_SAFE_BODY="${BODY//'%'/'%25'}"
OUTPUT_SAFE_BODY="${OUTPUT_SAFE_BODY//$'\n'/'%0A'}" OUTPUT_SAFE_BODY="${OUTPUT_SAFE_BODY//$'\n'/'%0A'}"
OUTPUT_SAFE_BODY="${OUTPUT_SAFE_BODY//$'\r'/'%0D'}" OUTPUT_SAFE_BODY="${OUTPUT_SAFE_BODY//$'\r'/'%0D'}"
echo "::set-output name=BODY::$OUTPUT_SAFE_BODY" echo "BODY=$OUTPUT_SAFE_BODY" >> $GITHUB_OUTPUT
echo "$BODY" > CHANGELOG.txt echo "$BODY" > CHANGELOG.txt
- name: Upload Changelog [GitHub Actions] - name: Upload Changelog [GitHub Actions]
@ -228,7 +228,7 @@ jobs:
- name: Get Tag - name: Get Tag
id: tag_name id: tag_name
run: | run: |
echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/} echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Publish Release [GitHub] - name: Publish Release [GitHub]
uses: svenstaro/upload-release-action@2.3.0 uses: svenstaro/upload-release-action@2.3.0

View File

@ -108,7 +108,7 @@ jobs:
echo "Certificate expiration date: $EXPIRATION_DATE" echo "Certificate expiration date: $EXPIRATION_DATE"
echo "Days remaining before expiration: $DAYS_BEFORE_EXPIRATION" echo "Days remaining before expiration: $DAYS_BEFORE_EXPIRATION"
echo "::set-output name=days::$DAYS_BEFORE_EXPIRATION" echo "days=$DAYS_BEFORE_EXPIRATION" >> $GITHUB_OUTPUT
- name: Check if expiration notification period has been reached - name: Check if expiration notification period has been reached
id: check-expiration id: check-expiration

View File

@ -27,7 +27,7 @@ jobs:
- name: Get Tag - name: Get Tag
id: tag_name id: tag_name
run: | run: |
echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/} echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create full changelog - name: Create full changelog
id: full-changelog id: full-changelog

View File

@ -103,7 +103,7 @@ jobs:
run: | run: |
# Use of this flag in the github-label-sync command will cause it to only check the validity of the # Use of this flag in the github-label-sync command will cause it to only check the validity of the
# configuration. # configuration.
echo "::set-output name=flag::--dry-run" echo "flag=--dry-run" >> $GITHUB_OUTPUT
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3