diff mbox series

ci: avoid using the deprecated `set-env` construct

Message ID pull.781.git.1604712106219.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit c4ce007b4ccfb1ee59305d449897ddc6192c70ea
Headers show
Series ci: avoid using the deprecated `set-env` construct | expand

Commit Message

Johannes Schindelin Nov. 7, 2020, 1:21 a.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The `set-env` construct was deprecated as of the announcement in
https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Let's use the recommended alternative instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    ci: avoid using the deprecated set-env construct
    
    This avoids an ugly warning (see e.g. this run
    [https://github.com/gitgitgadget/git/actions/runs/350443139]).

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-781%2Fdscho%2Fno-set-env-in-github-workflows-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-781/dscho/no-set-env-in-github-workflows-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/781

 .github/workflows/check-whitespace.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 7f7ebe054af6d831b999d6c2241b9227c4e4e08d

Comments

Chris Webster Nov. 7, 2020, 6:51 a.m. UTC | #1
Looks good.  Doing a similar change in a related repo.

...chris.

...chris.
chris@webstech.net
webstech.com


On Fri, Nov 6, 2020 at 5:21 PM Johannes Schindelin via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The `set-env` construct was deprecated as of the announcement in
> https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
>
> Let's use the recommended alternative instead.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>     ci: avoid using the deprecated set-env construct
>
>     This avoids an ugly warning (see e.g. this run
>     [https://github.com/gitgitgadget/git/actions/runs/350443139]).
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-781%2Fdscho%2Fno-set-env-in-github-workflows-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-781/dscho/no-set-env-in-github-workflows-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/781
>
>  .github/workflows/check-whitespace.yml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml
> index 9d070b9cdf..c74b47de9e 100644
> --- a/.github/workflows/check-whitespace.yml
> +++ b/.github/workflows/check-whitespace.yml
> @@ -14,7 +14,7 @@ jobs:
>      steps:
>      - name: Set commit count
>        shell: bash
> -      run: echo "::set-env name=COMMIT_DEPTH::$((1+$COMMITS))"
> +      run: echo "COMMIT_DEPTH=$((1+$COMMITS))" >>$GITHUB_ENV
>        env:
>          COMMITS: ${{ github.event.pull_request.commits }}
>
>
> base-commit: 7f7ebe054af6d831b999d6c2241b9227c4e4e08d
> --
> gitgitgadget
Junio C Hamano Nov. 17, 2020, 6:19 a.m. UTC | #2
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The `set-env` construct was deprecated as of the announcement in
> https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
> ...
> diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml
> index 9d070b9cdf..c74b47de9e 100644
> --- a/.github/workflows/check-whitespace.yml
> +++ b/.github/workflows/check-whitespace.yml
> @@ -14,7 +14,7 @@ jobs:
>      steps:
>      - name: Set commit count
>        shell: bash
> -      run: echo "::set-env name=COMMIT_DEPTH::$((1+$COMMITS))"
> +      run: echo "COMMIT_DEPTH=$((1+$COMMITS))" >>$GITHUB_ENV
>        env:
>          COMMITS: ${{ github.event.pull_request.commits }}

Do we need something similar for ci/print-test-failures.sh to
prevent failures like https://github.com/git/git/runs/1409815807?

Perhaps like the following (which is copied-and-pasted without
understanding what is going on or without doing nothing more than
skimming [*1*])?


Reference

*1* https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable


 ci/print-test-failures.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git c/ci/print-test-failures.sh w/ci/print-test-failures.sh
index 92a983a265..c70d6cdbf2 100755
--- c/ci/print-test-failures.sh
+++ w/ci/print-test-failures.sh
@@ -48,7 +48,7 @@ do
 			;;
 		github-actions)
 			mkdir -p failed-test-artifacts
-			echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
+			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
 			cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
 			tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
 			continue
Johannes Schindelin Nov. 17, 2020, 3:21 p.m. UTC | #3
Hi Junio,

On Mon, 16 Nov 2020, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > The `set-env` construct was deprecated as of the announcement in
> > https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
> > ...
> > diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml
> > index 9d070b9cdf..c74b47de9e 100644
> > --- a/.github/workflows/check-whitespace.yml
> > +++ b/.github/workflows/check-whitespace.yml
> > @@ -14,7 +14,7 @@ jobs:
> >      steps:
> >      - name: Set commit count
> >        shell: bash
> > -      run: echo "::set-env name=COMMIT_DEPTH::$((1+$COMMITS))"
> > +      run: echo "COMMIT_DEPTH=$((1+$COMMITS))" >>$GITHUB_ENV
> >        env:
> >          COMMITS: ${{ github.event.pull_request.commits }}
>
> Do we need something similar for ci/print-test-failures.sh to
> prevent failures like https://github.com/git/git/runs/1409815807?
>
> Perhaps like the following (which is copied-and-pasted without
> understanding what is going on or without doing nothing more than
> skimming [*1*])?

Yes, of course, this precisely what we need.

Sorry for not even _thinking_ about `git grep set-env`. This seems the
only remaining use of that construct in our workflows, though.

Thanks,
Dscho

>
>
> Reference
>
> *1* https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
>
>
>  ci/print-test-failures.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git c/ci/print-test-failures.sh w/ci/print-test-failures.sh
> index 92a983a265..c70d6cdbf2 100755
> --- c/ci/print-test-failures.sh
> +++ w/ci/print-test-failures.sh
> @@ -48,7 +48,7 @@ do
>  			;;
>  		github-actions)
>  			mkdir -p failed-test-artifacts
> -			echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
> +			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
>  			cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
>  			tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
>  			continue
>
>
Junio C Hamano Nov. 17, 2020, 8:14 p.m. UTC | #4
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> Perhaps like the following (which is copied-and-pasted without
>> understanding what is going on or without doing nothing more than
>> skimming [*1*])?
>
> Yes, of course, this precisely what we need.

Thanks.

--- >8 ------ >8 ------ >8 --- cut here --- >8 ------ >8 ------ >8 ---

Subject: [PATCH] ci: avoid `set-env` construct in print-test-failures.sh

Imitating cac42e47 (ci: avoid using the deprecated `set-env`
construct, 2020-11-07), avoid deprecated ::set-env and use the
recommended alternative instead in print-test-failures.sh

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 ci/print-test-failures.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
index 92a983a265..c70d6cdbf2 100755
--- a/ci/print-test-failures.sh
+++ b/ci/print-test-failures.sh
@@ -48,7 +48,7 @@ do
 			;;
 		github-actions)
 			mkdir -p failed-test-artifacts
-			echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
+			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
 			cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
 			tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
 			continue
Johannes Schindelin Nov. 18, 2020, 11:48 a.m. UTC | #5
Hi Junio,

On Tue, 17 Nov 2020, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> >> Perhaps like the following (which is copied-and-pasted without
> >> understanding what is going on or without doing nothing more than
> >> skimming [*1*])?
> >
> > Yes, of course, this precisely what we need.
>
> Thanks.
>
> --- >8 ------ >8 ------ >8 --- cut here --- >8 ------ >8 ------ >8 ---
>
> Subject: [PATCH] ci: avoid `set-env` construct in print-test-failures.sh
>
> Imitating cac42e47 (ci: avoid using the deprecated `set-env`
> construct, 2020-11-07), avoid deprecated ::set-env and use the
> recommended alternative instead in print-test-failures.sh
>
> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thank you so much for tying up this loose end,
Dscho

> ---
>  ci/print-test-failures.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
> index 92a983a265..c70d6cdbf2 100755
> --- a/ci/print-test-failures.sh
> +++ b/ci/print-test-failures.sh
> @@ -48,7 +48,7 @@ do
>  			;;
>  		github-actions)
>  			mkdir -p failed-test-artifacts
> -			echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
> +			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
>  			cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
>  			tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
>  			continue
> --
> 2.29.2-458-g8cf0a80384
>
>
diff mbox series

Patch

diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml
index 9d070b9cdf..c74b47de9e 100644
--- a/.github/workflows/check-whitespace.yml
+++ b/.github/workflows/check-whitespace.yml
@@ -14,7 +14,7 @@  jobs:
     steps:
     - name: Set commit count
       shell: bash
-      run: echo "::set-env name=COMMIT_DEPTH::$((1+$COMMITS))"
+      run: echo "COMMIT_DEPTH=$((1+$COMMITS))" >>$GITHUB_ENV
       env:
         COMMITS: ${{ github.event.pull_request.commits }}