Skip to content

Commit

Permalink
security: set-output cmd deprecated. Use $GITHUB_OUTPUT env file
Browse files Browse the repository at this point in the history
To avoid untrusted logged data to use `save-state` and `set-output` workflow commands without the intention of the workflow author we have introduced a new set of environment files to manage state and output.

Starting 1st June 2023 workflows using `save-state` or `set-output` commands via stdout will fail with an error.

https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
  • Loading branch information
davorpa committed Feb 22, 2023
1 parent bcd9818 commit d9de210
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/actions/awesomebot-gh-summary-action/action.yml
Expand Up @@ -91,7 +91,7 @@ runs:
$text = $text -replace "`n","%0A"
$text = $text -replace "`r","%25"
# set output
echo "::set-output name=text::$text"
echo "text=$text" >> $env:GITHUB_OUTPUT
- name: Write output
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-urls.yml
Expand Up @@ -29,9 +29,9 @@ jobs:
- name: Determine workflow parameters
id: init-params
run: |
echo "::set-output name=fetch_depth::0";
echo "fetch_depth=0" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "::set-output name=fetch_depth::0";
echo "fetch_depth=0" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/detect-conflicting-prs.yml
Expand Up @@ -51,10 +51,12 @@ jobs:
run: |
echo "$INPUT_PRS" \
| jq --compact-output --raw-output 'to_entries | map({number: .key, dirty: .value})' \
| sed -e 's/^/::set-output name=prs::/'
| sed -e 's/^/prs=/' \
>> $GITHUB_OUTPUT
echo "$INPUT_PRS" \
| jq --raw-output 'to_entries | length' \
| sed -e 's/^/::set-output name=prs-len::/'
| sed -e 's/^/prs-len=/' \
>> $GITHUB_OUTPUT
env:
INPUT_PRS: ${{ steps.pr-labeler.outputs.prDirtyStatuses }}

Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/stale.yml
Expand Up @@ -129,17 +129,21 @@ jobs:
run: |
echo $INPUT_ISSUES \
| jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
| sed -e 's/^/::set-output name=issues::/'
| sed -e 's/^/issues=/' \
>> $GITHUB_OUTPUT
echo $INPUT_ISSUES \
| jq --raw-output '. | length' \
| sed -e 's/^/::set-output name=issues-len::/'
| sed -e 's/^/issues-len=/' \
>> $GITHUB_OUTPUT
echo $INPUT_PRS \
| jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
| sed -e 's/^/::set-output name=prs::/'
| sed -e 's/^/prs=/' \
>> $GITHUB_OUTPUT
echo $INPUT_PRS \
| jq --raw-output '. | length' \
| sed -e 's/^/::set-output name=prs-len::/'
| sed -e 's/^/prs-len=/' \
>> $GITHUB_OUTPUT
env:
INPUT_ISSUES: ${{ steps.stale-issues.outputs.staled-issues-prs }}
INPUT_PRS: ${{ steps.stale-prs.outputs.staled-issues-prs }}
Expand All @@ -148,17 +152,21 @@ jobs:
run: |
echo $INPUT_ISSUES \
| jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
| sed -e 's/^/::set-output name=issues::/'
| sed -e 's/^/issues=/' \
>> $GITHUB_OUTPUT
echo $INPUT_ISSUES \
| jq --raw-output '. | length' \
| sed -e 's/^/::set-output name=issues-len::/'
| sed -e 's/^/issues-len=/' \
>> $GITHUB_OUTPUT
echo $INPUT_PRS \
| jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
| sed -e 's/^/::set-output name=prs::/'
| sed -e 's/^/prs=/' \
>> $GITHUB_OUTPUT
echo $INPUT_PRS \
| jq --raw-output '. | length' \
| sed -e 's/^/::set-output name=prs-len::/'
| sed -e 's/^/prs-len=/' \
>> $GITHUB_OUTPUT
env:
INPUT_ISSUES: ${{ steps.stale-issues.outputs.closed-issues-prs }}
INPUT_PRS: ${{ steps.stale-prs.outputs.closed-issues-prs }}
Expand Down

0 comments on commit d9de210

Please sign in to comment.