Skip to content

Commit 0f27e10

Browse files
authored
Gh actions set output deprecation fix (#8034)
* GH actions fix set-output deprecation [ci lang-only Pascal] * Fix multiline output * Try again * Try again [ci lang-only Pascal] * Another try [ci lang-only Pascal] * Change to echo [ci lang-only Pascal] * Update info link [ci lang-only Pascal]
1 parent 8149c74 commit 0f27e10

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,16 @@ jobs:
6565
- id: event_out
6666
name: Write event outputs
6767
run: |
68-
# Escape the multiline string for Github Actions, see https://github.community/t/set-output-truncates-multiline-strings/16852/3
69-
COMMIT_MESSAGE="${COMMIT_MESSAGE//'%'/'%25'}"
70-
COMMIT_MESSAGE="${COMMIT_MESSAGE//$'\n'/'%0A'}"
71-
COMMIT_MESSAGE="${COMMIT_MESSAGE//$'\r'/'%0D'}"
72-
echo "::set-output name=commit_message::$COMMIT_MESSAGE"
73-
echo "::set-output name=branch_name::$BRANCH_NAME"
74-
echo "::set-output name=target_branch_name::$TARGET_BRANCH_NAME"
75-
echo "::set-output name=previous_commit::$PREVIOUS_COMMIT"
68+
# Escape the multiline string for Github Actions, see https://lab.amalitsky.com/posts/2022/github-actions-set-output-migration/#migration-from-set-output-to-github-output
69+
delimiter="$(openssl rand -hex 8)"
70+
{
71+
echo "commit_message<<${delimiter}"
72+
echo $COMMIT_MESSAGE
73+
echo "${delimiter}"
74+
} >> $GITHUB_OUTPUT
75+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
76+
echo "target_branch_name=$TARGET_BRANCH_NAME" >> $GITHUB_OUTPUT
77+
echo "previous_commit=$PREVIOUS_COMMIT" >> $GITHUB_OUTPUT
7678
- id: verify_out
7779
name: Write verify job matrix
7880
run: |
@@ -82,7 +84,7 @@ jobs:
8284
# - TESTLANG: {lang}
8385
# with a TESTLANG object in the include array for each language under frameworks
8486
VERIFY_MATRIX=$(ls -1 frameworks | jq -Rc '.+"/" | select(inside(env.RUN_TESTS)) | rtrimstr("/")' | jq -sc '{include: map({TESTLANG: .})}')
85-
echo "::set-output name=verify_matrix::$VERIFY_MATRIX"
87+
echo "verify_matrix=$VERIFY_MATRIX" >> $GITHUB_OUTPUT
8688
outputs:
8789
commit_message: ${{ steps.event_out.outputs.commit_message }}
8890
branch_name: ${{ steps.event_out.outputs.branch_name }}

0 commit comments

Comments
 (0)