diff options
author | Luke Bakken <luke@bakken.io> | 2022-10-22 13:45:48 -0700 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2022-10-25 14:20:49 +0200 |
commit | e3e66033d4d520a295dc943aae4bdcf428435b62 (patch) | |
tree | 7384e3ced5eb6bb39150064371ab60f65527f060 /.github | |
parent | c43e13b9f8226011ae07238e29c3c88a6afccf70 (diff) | |
download | erlang-e3e66033d4d520a295dc943aae4bdcf428435b62.tar.gz |
Convert from `::set-output` to `GITHUB_OUTPUT`
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Diffstat (limited to '.github')
-rwxr-xr-x | .github/scripts/build-base-image.sh | 14 | ||||
-rwxr-xr-x | .github/scripts/get-pr-number.es | 16 | ||||
-rw-r--r-- | .github/workflows/main.yaml | 12 | ||||
-rw-r--r-- | .github/workflows/pr-comment.yaml | 4 |
4 files changed, 29 insertions, 17 deletions
diff --git a/.github/scripts/build-base-image.sh b/.github/scripts/build-base-image.sh index 543235e126..7069ef391a 100755 --- a/.github/scripts/build-base-image.sh +++ b/.github/scripts/build-base-image.sh @@ -29,16 +29,16 @@ case "${BASE_TAG}" in ;; esac -echo "::set-output name=BASE::${BASE}" -echo "::set-output name=BASE_TAG::${BASE_TAG}" -echo "::set-output name=BASE_TYPE::${BASE_TYPE}" +echo "BASE=${BASE}" >> $GITHUB_OUTPUT +echo "BASE_TAG=${BASE_TAG}" >> $GITHUB_OUTPUT +echo "BASE_TYPE=${BASE_TYPE}" >> $GITHUB_OUTPUT if [ -f "otp_docker_base.tar" ]; then docker load -i "otp_docker_base.tar" - echo "::set-output name=BASE_BUILD::loaded" + echo "BASE_BUILD=loaded" >> $GITHUB_OUTPUT elif [ -f "otp_docker_base/otp_docker_base.tar" ]; then docker load -i "otp_docker_base/otp_docker_base.tar" - echo "::set-output name=BASE_BUILD::loaded" + echo "BASE_BUILD=loaded" >> $GITHUB_OUTPUT else if [ "${BASE_USE_CACHE}" != "false" ]; then docker pull "${BASE_TAG}:${BASE_BRANCH}" @@ -58,9 +58,9 @@ else NEW_BASE_IMAGE_ID=$(docker images -q "${BASE_TAG}:latest") if [ "${BASE_IMAGE_ID}" = "${NEW_BASE_IMAGE_ID}" ]; then - echo "::set-output name=BASE_BUILD::cached" + echo "BASE_BUILD=cached" >> $GITHUB_OUTPUT else - echo "::set-output name=BASE_BUILD::re-built" + echo "BASE_BUILD=re-built" >> $GITHUB_OUTPUT docker save "${BASE_TAG}:latest" > "otp_docker_base.tar" fi fi diff --git a/.github/scripts/get-pr-number.es b/.github/scripts/get-pr-number.es index e358d9eed1..a388e6107a 100755 --- a/.github/scripts/get-pr-number.es +++ b/.github/scripts/get-pr-number.es @@ -11,9 +11,19 @@ main([Repo, HeadSha]) -> string:equal(HeadSha, Sha) end, AllOpenPrs) of {value, #{ <<"number">> := Number } } -> - io:format("::set-output name=result::~p~n", [Number]); + append_to_github_output("result=~p~n", [Number]); false -> - io:format("::set-output name=result::~ts~n", [""]) + append_to_github_output("result=~ts~n", [""]) + end. + +append_to_github_output(Fmt, Args) -> + case os:getenv("GITHUB_OUTPUT") of + false -> + io:format(standard_error, "GITHUB_OUTPUT env var missing?~n", []); + GitHubOutputFile -> + {ok, F} = file:open(GitHubOutputFile, [write, append]), + ok = io:fwrite(F, Fmt, Args), + ok = file:close(F) end. ghapi(CMD) -> @@ -37,7 +47,7 @@ decodeTail(Data) -> {with_tail, Json, Tail} -> [Json | decodeTail(Tail)] catch E:R:ST -> - io:format("Failed to decode: ~ts",[Data]), + io:format(standard_error, "Failed to decode: ~ts",[Data]), erlang:raise(E,R,ST) end. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a9435952b2..bd16db2e23 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -41,7 +41,7 @@ jobs: .github/scripts/path-filters.sh > .github/scripts/path-filters.yaml ALL_APPS=$(grep '^[a-z_]*:' .github/scripts/path-filters.yaml | sed 's/:.*$//') ALL_APPS=$(jq -n --arg inarr "${ALL_APPS}" '$inarr | split("\n")' | tr '\n' ' ') - echo "::set-output name=all::${ALL_APPS}" + echo "all=${ALL_APPS}" >> $GITHUB_OUTPUT - uses: dorny/paths-filter@v2 id: changes with: @@ -250,11 +250,13 @@ jobs: # actions/cache on Windows sometimes does not set cache-hit even though there was one. Setting it manually. - name: Set wxWidgets cache id: wxwidgets-cache + env: + WSLENV: GITHUB_OUTPUT/p run: | if [ -d wxWidgets ]; then - echo "::set-output name=cache-hit::true" + echo "cache-hit=true" >> $GITHUB_OUTPUT else - echo "::set-output name=cache-hit::false" + echo "cache-hit=false" >> $GITHUB_OUTPUT fi - name: Download wxWidgets @@ -695,8 +697,8 @@ jobs: run: | TAG=${GITHUB_REF#refs/tags/} VSN=${TAG#OTP-} - echo "::set-output name=tag::${TAG}" - echo "::set-output name=vsn::${VSN}" + echo "tag=${TAG}" >> $GITHUB_OUTPUT + echo "vsn=${VSN}" >> $GITHUB_OUTPUT - uses: actions/checkout@v3 diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index 4ae88c38aa..aac5bb4970 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -74,9 +74,9 @@ jobs: done if [ -d "Unit Test Results" ]; then - echo "::set-output name=HAS_TEST_ARTIFACTS::true" + echo "HAS_TEST_ARTIFACTS=true" >> $GITHUB_OUTPUT else - echo "::set-output name=HAS_TEST_ARTIFACTS::false" + echo "HAS_TEST_ARTIFACTS=false" >> $GITHUB_OUTPUT fi - uses: actions/checkout@v2 |