Skip to content

Commit 149e5f7

Browse files
committed
fix(deprecate): echo ::set-output is deprecated, use environment files
GitHub deprecated the `set-output` (and `set-state`, which we did not use) commands in Actions scripts due to trust issues. This patch moves the output management to the new format involving _"Environment files"_.
1 parent dd6bc71 commit 149e5f7

12 files changed

+49
-42
lines changed

action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ runs:
171171
IN_VERSION: ${{ inputs.version }}
172172
shell: bash
173173
run: |
174-
set -x
174+
echo "Creating a CodeChecker package..."
175+
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
176+
set -x
177+
fi
178+
175179
if [[ "$IN_INSTALL_CUSTOM" == "true" ]]; then
176180
${{ github.action_path }}/src/build-codechecker.sh
177181
else
@@ -227,16 +231,19 @@ runs:
227231
id: analyze-or-report
228232
shell: bash
229233
run: |
234+
echo "(Executing GitHub Actions technical detail...)"
235+
echo "::group::(Technical detail, forwarding result of analysis...)"
230236
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
231237
set -x
232238
fi
233239
234240
if [[ "${{ inputs.report-converter }}" != "true" ]]
235241
then
236-
echo "::set-output name=OUTPUT_DIR::${{ steps.analyze.outputs.OUTPUT_DIR }}"
242+
echo "OUTPUT_DIR=${{ steps.analyze.outputs.OUTPUT_DIR }}" >> "$GITHUB_OUTPUT"
237243
else
238-
echo "::set-output name=OUTPUT_DIR::${{ steps.report-convert.outputs.OUTPUT_DIR }}"
244+
echo "OUTPUT_DIR=${{ steps.report-convert.outputs.OUTPUT_DIR }}" >> "$GITHUB_OUTPUT"
239245
fi
246+
echo "::endgroup::"
240247
241248
- name: "Parse and convert results to HTML"
242249
id: parse

src/build-codechecker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ else
3838
echo "CodeChecker 'web' package not built."
3939
fi
4040

41-
echo "::set-output name=PATH::$(readlink -f ./build/CodeChecker/bin)"
42-
echo "::set-output name=VERSION::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')"
43-
echo "::set-output name=GITSEVEN::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)"
41+
echo "PATH=$(readlink -f ./build/CodeChecker/bin)" >> "$GITHUB_OUTPUT"
42+
echo "VERSION=$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')" >> "$GITHUB_OUTPUT"
43+
echo "GITSEVEN=$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)" >> "$GITHUB_OUTPUT"
4444

4545
popd

src/diff-pre.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ fi
2323

2424
if [[ ! -z "$IN_DIFF_RUN_NAME" && "$IN_DIFF_RUN_NAME" != "__DEFAULT__" ]]; then
2525
echo "Using user-requested run name."
26-
echo "::set-output name=RUN_NAME::$IN_DIFF_RUN_NAME"
27-
echo "::set-output name=DIFF_CONFIGURED::true"
26+
echo "RUN_NAME=$IN_DIFF_RUN_NAME" >> "$GITHUB_OUTPUT"
27+
echo "DIFF_CONFIGURED=true" >> "$GITHUB_OUTPUT"
2828
exit 0
2929
fi
3030

3131
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
3232
echo "Auto-generating run name for a PULL REQUEST's target (base)."
33-
echo "::set-output name=RUN_NAME::$GITHUB_REPOSITORY\: $GITHUB_BASE_REF"
34-
echo "::set-output name=DIFF_CONFIGURED::true"
33+
echo "RUN_NAME=$GITHUB_REPOSITORY\: $GITHUB_BASE_REF" >> "$GITHUB_OUTPUT"
34+
echo "DIFF_CONFIGURED=true" >> "$GITHUB_OUTPUT"
3535
exit 0
3636
elif [[ "$GITHUB_REF_TYPE" == "branch" ]]; then
3737
echo "Auto-generating run name for a BRANCH."
38-
echo "::set-output name=RUN_NAME::$GITHUB_REPOSITORY\: $GITHUB_REF_NAME"
39-
echo "::set-output name=DIFF_CONFIGURED::true"
38+
echo "RUN_NAME=$GITHUB_REPOSITORY\: $GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
39+
echo "DIFF_CONFIGURED=true" >> "$GITHUB_OUTPUT"
4040
exit 0
4141
elif [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
4242
echo "Auto-generating run name for a TAG."
43-
echo "::set-output name=RUN_NAME::$GITHUB_REPOSITORY tags"
44-
echo "::set-output name=DIFF_CONFIGURED::true"
43+
echo "RUN_NAME=$GITHUB_REPOSITORY tags" >> "$GITHUB_OUTPUT"
44+
echo "DIFF_CONFIGURED=true" >> "$GITHUB_OUTPUT"
4545
exit 0
4646
fi
4747

4848
echo "::notice title=Preparation for diff::Failed to generate a run name. Implementation error?"
49-
echo "::set-output name=DIFF_CONFIGURED::false"
49+
echo "DIFF_CONFIGURED=false" >> "$GITHUB_OUTPUT"

src/diff.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ echo "::group::Generating HTML results from diff"
4040
--output html \
4141
--export "$OUTPUT_DIR" \
4242
|| true
43-
echo "::set-output name=HTML_DIR::$OUTPUT_DIR"
43+
echo "HTML_DIR=$OUTPUT_DIR" >> "$GITHUB_OUTPUT"
4444
echo "::endgroup::"
4545

4646
echo "::group::Printing diff results to log"
@@ -54,17 +54,17 @@ echo "::group::Printing diff results to log"
5454
EXIT_CODE=$?
5555

5656
cat "$OUTPUT_LOG"
57-
echo "::set-output name=OUTPUT_LOG::$OUTPUT_LOG"
57+
echo "OUTPUT_LOG=$OUTPUT_LOG" >> "$GITHUB_OUTPUT"
5858
echo "::endgroup::"
5959

6060
if [[ $EXIT_CODE -eq 2 ]]; then
61-
echo "::set-output name=HAS_NEW_FINDINGS::true"
61+
echo "HAS_NEW_FINDINGS=true" >> "$GITHUB_OUTPUT"
6262

6363
# Let the job continue. If there were new results, the script may be breaking
6464
# the build in a later step. (After a potential upload to server.)
6565
EXIT_CODE=0
6666
elif [[ $EXIT_CODE -eq 0 ]]; then
67-
echo "::set-output name=HAS_NEW_FINDINGS::false"
67+
echo "HAS_NEW_FINDINGS=false" >> "$GITHUB_OUTPUT"
6868
fi
6969

7070
# Exit code 1 is internal error of executing the step.

src/execute-analysis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ if [[ $EXIT_CODE -ne 0 && "$IN_IGNORE_CRASHES" == "true" ]]; then
4949
EXIT_CODE=0
5050
fi
5151

52-
echo "::set-output name=OUTPUT_DIR::$OUTPUT_DIR"
52+
echo "OUTPUT_DIR=$OUTPUT_DIR" >> "$GITHUB_OUTPUT"
5353
exit $EXIT_CODE

src/get-llvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ update-alternatives --query clang
3333
update-alternatives --query clang-tidy
3434
echo "::endgroup::"
3535

36-
echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"
36+
echo "REAL_VERSION=$(clang --version | head -n 1 | cut -d' ' -f4-)" >> "$GITHUB_OUTPUT"

src/get-or-create-build-json.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ else
2929
exit 1
3030
fi
3131

32-
echo "::set-output name=COMPILATION_DATABASE::$OUT_FILE"
32+
echo "COMPILATION_DATABASE=$OUT_FILE" >> "$GITHUB_OUTPUT"
3333
exit $EXIT_CODE

src/parse-results.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ echo "::group::Generating HTML results from analysis"
3232
--output "$OUTPUT_DIR" \
3333
--trim-path-prefix "$PROJECT_PATH" \
3434
|| true
35-
echo "::set-output name=HTML_DIR::$OUTPUT_DIR"
35+
echo "HTML_DIR=$OUTPUT_DIR" >> "$GITHUB_OUTPUT"
3636
echo "::endgroup::"
3737

3838
echo "::group::Printing analysis results to log"
@@ -43,17 +43,17 @@ echo "::group::Printing analysis results to log"
4343
EXIT_CODE=$?
4444

4545
cat "$OUTPUT_LOG"
46-
echo "::set-output name=OUTPUT_LOG::$OUTPUT_LOG"
46+
echo "OUTPUT_LOG=$OUTPUT_LOG" >> "$GITHUB_OUTPUT"
4747
echo "::endgroup::"
4848

4949
if [[ $EXIT_CODE -eq 2 ]]; then
50-
echo "::set-output name=HAS_FINDINGS::true"
50+
echo "HAS_FINDINGS=true" >> "$GITHUB_OUTPUT"
5151

5252
# Let the jobs continue. If there were findings, the script may be breaking
5353
# the build in a later step. (After a potential upload to server.)
5454
EXIT_CODE=0
5555
elif [[ $EXIT_CODE -eq 0 ]]; then
56-
echo "::set-output name=HAS_FINDINGS::false"
56+
echo "HAS_FINDINGS=false" >> "$GITHUB_OUTPUT"
5757
fi
5858

5959
# Exit code 1 is internal error of executing the step.

src/pip-codechecker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ which CodeChecker
1818
CodeChecker analyzer-version
1919
CodeChecker web-version
2020

21-
echo "::set-output name=PATH::$(dirname $(which CodeChecker))"
22-
echo "::set-output name=VERSION::$(CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')"
23-
echo "::set-output name=GITSEVEN::$(CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)"
21+
echo "PATH=$(dirname $(which CodeChecker))" >> "$GITHUB_OUTPUT"
22+
echo "VERSION=$(CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')" >> "$GITHUB_OUTPUT"
23+
echo "GITSEVEN=$(CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)" >> "$GITHUB_OUTPUT"

src/report-converter.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ if [[ $EXIT_CODE -ne 0 && "$IN_IGNORE_CRASHES" == "true" ]]; then
4444
EXIT_CODE=0
4545
fi
4646

47-
echo "::set-output name=OUTPUT_DIR::$OUTPUT_DIR"
47+
echo "OUTPUT_DIR=$OUTPUT_DIR" >> "$GITHUB_OUTPUT"
4848
exit $EXIT_CODE

0 commit comments

Comments
 (0)