Skip to content

Commit 994b9dd

Browse files
committed
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.
1 parent 3cfb128 commit 994b9dd

8 files changed

+75
-19
lines changed

.github/workflows/check-go-dependencies-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
RESULT="false"
5858
fi
5959
60-
echo "::set-output name=result::$RESULT"
60+
echo "result=$RESULT" >> $GITHUB_OUTPUT
6161
6262
check-cache:
6363
needs: run-determination

.github/workflows/check-go-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
RESULT="false"
5252
fi
5353
54-
echo "::set-output name=result::$RESULT"
54+
echo "result=$RESULT" >> $GITHUB_OUTPUT
5555
5656
check-errors:
5757
name: check-errors (${{ matrix.module.path }})

.github/workflows/compare-performance.yml

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
exit 1
7171
fi
7272
73-
echo "::set-output name=ref::$COMPARISON_REF"
73+
echo "ref=$COMPARISON_REF" >> $GITHUB_OUTPUT
7474
7575
run:
7676
name: Run at ${{ matrix.data.ref }} (${{ matrix.data.description }})
@@ -126,7 +126,7 @@ jobs:
126126
# anyway.
127127
USE_GO_VERSION="1.14"
128128
fi
129-
echo "::set-output name=version::$USE_GO_VERSION"
129+
echo "version=$USE_GO_VERSION" >> $GITHUB_OUTPUT
130130
131131
- name: Install Go
132132
uses: actions/setup-go@v4
@@ -201,11 +201,38 @@ jobs:
201201
./libraries-repository-engine "${{ env.CONFIG_PATH }}" "${{ env.REGISTRY_PATH }}"
202202
203203
# Define step outputs with the performance data
204-
echo "::set-output name=Type::fresh"
205-
echo "::set-output name=Duration::$SECONDS"
206-
echo "::set-output name=GitClonesSize::$(du --apparent-size --bytes --summarize "${{ env.GIT_CLONES_PATH }}" | cut --fields=1)"
207-
echo "::set-output name=LibraryArchivesSize::$(du --apparent-size --bytes --summarize "${{ env.LIBRARY_ARCHIVES_PATH }}" | cut --fields=1)"
208-
echo "::set-output name=LogsSize::$(du --apparent-size --bytes --summarize "${{ env.LOGS_PATH }}" | cut --fields=1)"
204+
echo "Type=fresh" >> $GITHUB_OUTPUT
205+
echo "Duration=$SECONDS" >> $GITHUB_OUTPUT
206+
echo "GitClonesSize=$( \
207+
du \
208+
--apparent-size \
209+
--bytes \
210+
--summarize \
211+
"${{ env.GIT_CLONES_PATH }}" \
212+
| \
213+
cut \
214+
--fields=1 \
215+
)" >> $GITHUB_OUTPUT
216+
echo "LibraryArchivesSize=$( \
217+
du \
218+
--apparent-size \
219+
--bytes \
220+
--summarize \
221+
"${{ env.LIBRARY_ARCHIVES_PATH }}" \
222+
| \
223+
cut \
224+
--fields=1 \
225+
)" >> $GITHUB_OUTPUT
226+
echo "LogsSize=$( \
227+
du \
228+
--apparent-size \
229+
--bytes \
230+
--summarize \
231+
"${{ env.LOGS_PATH }}" \
232+
| \
233+
cut \
234+
--fields=1 \
235+
)" >> $GITHUB_OUTPUT
209236
210237
- name: Run sync on populated database
211238
id: populated
@@ -214,11 +241,38 @@ jobs:
214241
./libraries-repository-engine "${{ env.CONFIG_PATH }}" "${{ env.REGISTRY_PATH }}"
215242
216243
# Define step outputs with the performance data
217-
echo "::set-output name=Type::populated"
218-
echo "::set-output name=Duration::$SECONDS"
219-
echo "::set-output name=GitClonesSize::$(du --apparent-size --bytes --summarize "${{ env.GIT_CLONES_PATH }}" | cut --fields=1)"
220-
echo "::set-output name=LibraryArchivesSize::$(du --apparent-size --bytes --summarize "${{ env.LIBRARY_ARCHIVES_PATH }}" | cut --fields=1)"
221-
echo "::set-output name=LogsSize::$(du --apparent-size --bytes --summarize "${{ env.LOGS_PATH }}" | cut --fields=1)"
244+
echo "Type=populated" >> $GITHUB_OUTPUT
245+
echo "Duration=$SECONDS" >> $GITHUB_OUTPUT
246+
echo "GitClonesSize=$( \
247+
du \
248+
--apparent-size \
249+
--bytes \
250+
--summarize \
251+
"${{ env.GIT_CLONES_PATH }}" \
252+
| \
253+
cut \
254+
--fields=1 \
255+
)" >> $GITHUB_OUTPUT
256+
echo "LibraryArchivesSize=$( \
257+
du \
258+
--apparent-size \
259+
--bytes \
260+
--summarize \
261+
"${{ env.LIBRARY_ARCHIVES_PATH }}" \
262+
| \
263+
cut \
264+
--fields=1 \
265+
)" >> $GITHUB_OUTPUT
266+
echo "LogsSize=$( \
267+
du \
268+
--apparent-size \
269+
--bytes \
270+
--summarize \
271+
"${{ env.LOGS_PATH }}" \
272+
| \
273+
cut \
274+
--fields=1 \
275+
)" >> $GITHUB_OUTPUT
222276
223277
- name: Create report
224278
run: |

.github/workflows/publish-go-tester-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
RESULT="false"
4949
fi
5050
51-
echo "::set-output name=result::$RESULT"
51+
echo "result=$RESULT" >> $GITHUB_OUTPUT
5252
5353
build:
5454
needs: run-determination

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ jobs:
8484
- name: Identify Prerelease
8585
id: prerelease
8686
run: |
87-
if [[ "$("${{ env.SEMVER_TOOL_PATH }}" get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi
87+
if [[ "$("${{ env.SEMVER_TOOL_PATH }}" get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then
88+
echo "IS_PRE=true" >> $GITHUB_OUTPUT
89+
fi
8890
8991
- name: Create Release
9092
uses: ncipollo/release-action@v1

.github/workflows/sync-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
run: |
110110
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
111111
# configuration.
112-
echo "::set-output name=flag::--dry-run"
112+
echo "flag=--dry-run" >> $GITHUB_OUTPUT
113113
114114
- name: Checkout repository
115115
uses: actions/checkout@v3

.github/workflows/test-go-integration-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
RESULT="false"
6464
fi
6565
66-
echo "::set-output name=result::$RESULT"
66+
echo "result=$RESULT" >> $GITHUB_OUTPUT
6767
6868
test:
6969
needs: run-determination

.github/workflows/test-go-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
RESULT="false"
5353
fi
5454
55-
echo "::set-output name=result::$RESULT"
55+
echo "result=$RESULT" >> $GITHUB_OUTPUT
5656
5757
test:
5858
name: test (${{ matrix.module.path }} - ${{ matrix.operating-system }})

0 commit comments

Comments
 (0)