# [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows

11 messages from 2022-12-07 to 2022-12-08. Participants: Johannes Schindelin via GitGitGadget, Taylor Blau, Ævar Arnfjörð Bjarmason, Junio C Hamano.
Thread: https://gitlist.dev/t/58915

## Johannes Schindelin via GitGitGadget, 2022-12-07 14:34

Subject: [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows
Message-ID: <pull.1440.git.1670423680.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1440.git.1670423680.gitgitgadget%40gmail.com

```
We are using a couple of GitHub Actions features that have been deprecated
since we started using them. One of these features is addressed in Oscar's
contribution over at
https://lore.kernel.org/git/pull.1354.v2.git.git.1670234474721.gitgitgadget@gmail.com/,
on which this here patch series is based.

I waited for quite a while with submitting this because I did not want to
interfere with patch series that are in flight, but it seems that this was
unwise, as there is now a patch floating about (ab/ci-retire-set-output)
that partially fulfills this here patch series' purpose. However, these
patches are more complete, so I proposed to supersede that patch with this
more comprehensive solution.

This patch series is based on od/ci-use-checkout-v3-when-applicable.

Johannes Schindelin (4):
  ci: use a newer `github-script` version
  ci: avoid deprecated `set-output` workflow command
  ci: avoid using deprecated {up,down}load-artifacts Action
  ci(l10n): avoid using the deprecated `set-output` workflow command

 .github/workflows/l10n.yml |  4 ++--
 .github/workflows/main.yml | 30 ++++++++++++++++++------------
 2 files changed, 20 insertions(+), 14 deletions(-)


base-commit: 6cf4d908a92296654f891d440fe09d9fd34b2272
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1440%2Fdscho%2Fci-set-output-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1440/dscho/ci-set-output-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1440
-- 
gitgitgadget

```

## Johannes Schindelin via GitGitGadget, 2022-12-07 14:34

Subject: [PATCH 1/4] ci: use a newer `github-script` version
Message-ID: <472481561f03900fb519065d88ae8af910bea794.1670423680.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/472481561f03900fb519065d88ae8af910bea794.1670423680.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The old version we currently use runs in node.js v12.x, which is being
deprecated in GitHub Actions. The new version uses node.js v16.x.

Incidentally, this also avoids the warning about the deprecated
`::set-output::` workflow command because the newer version of the
`github-script` Action uses the recommended new way to specify outputs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 .github/workflows/main.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5262823eb1c..43d47824dd3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -37,14 +37,14 @@ jobs:
           echo "::set-output name=enabled::$enabled"
       - name: skip if the commit or tree was already tested
         id: skip-if-redundant
-        uses: actions/github-script@v3
+        uses: actions/github-script@v6
         if: steps.check-ref.outputs.enabled == 'yes'
         with:
           github-token: ${{secrets.GITHUB_TOKEN}}
           script: |
             try {
               // Figure out workflow ID, commit and tree
-              const { data: run } = await github.actions.getWorkflowRun({
+              const { data: run } = await github.rest.actions.getWorkflowRun({
                 owner: context.repo.owner,
                 repo: context.repo.repo,
                 run_id: context.runId,
@@ -54,7 +54,7 @@ jobs:
               const tree_id = run.head_commit.tree_id;
 
               // See whether there is a successful run for that commit or tree
-              const { data: runs } = await github.actions.listWorkflowRuns({
+              const { data: runs } = await github.rest.actions.listWorkflowRuns({
                 owner: context.repo.owner,
                 repo: context.repo.repo,
                 per_page: 500,
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2022-12-07 14:34

Subject: [PATCH 2/4] ci: avoid deprecated `set-output` workflow command
Message-ID: <1693393443975bc25f3020e61a29944804e35601.1670423680.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/1693393443975bc25f3020e61a29944804e35601.1670423680.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Due to security concerns, this command was deprecated and we need to
write into `$GITHUB_OUTPUT` instead. For more details, see
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 43d47824dd3..1e95aa86b6c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -34,7 +34,7 @@ jobs:
           then
             enabled=no
           fi
-          echo "::set-output name=enabled::$enabled"
+          echo "enabled=$enabled" >>$GITHUB_OUTPUT
       - name: skip if the commit or tree was already tested
         id: skip-if-redundant
         uses: actions/github-script@v6
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2022-12-07 14:34

Subject: [PATCH 3/4] ci: avoid using deprecated {up,down}load-artifacts Action
Message-ID: <c9e99b4f96fc4e513c62b1b028e45559f6410c57.1670423680.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/c9e99b4f96fc4e513c62b1b028e45559f6410c57.1670423680.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The deprecated versions of these Actions still use node.js 12 whereas
workflows will need to use node.js 16 to avoid problems going forward.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .github/workflows/main.yml | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1e95aa86b6c..5e82d8d2b1b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -94,7 +94,7 @@ jobs:
     - name: zip up tracked files
       run: git archive -o artifacts/tracked.tar.gz HEAD
     - name: upload tracked files and build artifacts
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: windows-artifacts
         path: artifacts
@@ -108,7 +108,7 @@ jobs:
         nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
     steps:
     - name: download tracked files and build artifacts
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: windows-artifacts
         path: ${{github.workspace}}
@@ -125,7 +125,7 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: failed-tests-windows
         path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -177,7 +177,7 @@ jobs:
     - name: zip up tracked files
       run: git archive -o artifacts/tracked.tar.gz HEAD
     - name: upload tracked files and build artifacts
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: vs-artifacts
         path: artifacts
@@ -192,7 +192,7 @@ jobs:
     steps:
     - uses: git-for-windows/setup-git-for-windows-sdk@v1
     - name: download tracked files and build artifacts
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: vs-artifacts
         path: ${{github.workspace}}
@@ -210,7 +210,7 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: failed-tests-windows
         path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -267,7 +267,7 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: failed-tests-${{matrix.vector.jobname}}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -302,7 +302,13 @@ jobs:
       shell: bash
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
-      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
+      uses: actions/upload-artifact@v3
+      with:
+        name: failed-tests-${{matrix.vector.jobname}}
+        path: ${{env.FAILED_TEST_ARTIFACTS}}
+    - name: Upload failed tests' directories
+      if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
       uses: actions/upload-artifact@v1
       with:
         name: failed-tests-${{matrix.vector.jobname}}
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2022-12-07 14:34

Subject: [PATCH 4/4] ci(l10n): avoid using the deprecated `set-output` workflow command
Message-ID: <1081c62fb266bc41f7084ea2a974729315a7634a.1670423680.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/1081c62fb266bc41f7084ea2a974729315a7634a.1670423680.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

We need to use an environment file now. For more information see:
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .github/workflows/l10n.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/l10n.yml b/.github/workflows/l10n.yml
index 27f72f0ff34..2915c595b4f 100644
--- a/.github/workflows/l10n.yml
+++ b/.github/workflows/l10n.yml
@@ -23,8 +23,8 @@ jobs:
             base=${{ github.event.before }}
             head=${{ github.event.after }}
           fi
-          echo "::set-output name=base::$base"
-          echo "::set-output name=head::$head"
+          echo "base=$base" >>$GITHUB_OUTPUT
+          echo "head=$head" >>$GITHUB_OUTPUT
       - name: Run partial clone
         run: |
           git -c init.defaultBranch=master init --bare .
-- 
gitgitgadget

```

## Taylor Blau, 2022-12-07 22:22

Subject: Re: [PATCH 1/4] ci: use a newer `github-script` version
Message-ID: <Y5ESKYvOyrnbCV+B@nand.local>
URL: https://gitlist.dev/e/Y5ESKYvOyrnbCV%2BB%40nand.local
In-Reply-To: <472481561f03900fb519065d88ae8af910bea794.1670423680.git.gitgitgadget@gmail.com>

```
On Wed, Dec 07, 2022 at 02:34:37PM +0000, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The old version we currently use runs in node.js v12.x, which is being
> deprecated in GitHub Actions. The new version uses node.js v16.x.
>
> Incidentally, this also avoids the warning about the deprecated
> `::set-output::` workflow command because the newer version of the
> `github-script` Action uses the recommended new way to specify outputs.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>

It took me a second to remember why my S-o-b was here, but it looks like
this is from when I queued this patch in [1], which is on 'master' as of
63357b79c9 (ci: use a newer `github-script` version, 2022-11-08).

So having my S-o-b here is definitely OK (since I was the one who put it
there in the first place!), but I don't think we need to re-queue this
patch, unless it was reverted out in the meantime (which it doesn't
appear to be).

Thanks,
Taylor

[1]: https://lore.kernel.org/git/Y2q9723uEtfkJrah@nand.local/

```

## Taylor Blau, 2022-12-07 22:24

Subject: Re: [PATCH 2/4] ci: avoid deprecated `set-output` workflow command
Message-ID: <Y5ESknffj5iWF0IY@nand.local>
URL: https://gitlist.dev/e/Y5ESknffj5iWF0IY%40nand.local
In-Reply-To: <1693393443975bc25f3020e61a29944804e35601.1670423680.git.gitgitgadget@gmail.com>

```
On Wed, Dec 07, 2022 at 02:34:38PM +0000, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Due to security concerns, this command was deprecated and we need to
> write into `$GITHUB_OUTPUT` instead. For more details, see
> https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

OK, this one and [1] are pretty similar. I don't have a strong
preference between one or the other, though I suspect it will be easier
for the maintainer to pick them all up from the same series.

So in that sense I guess I have a slight preference for this one, though
I admit to not feeling very strongly about it ;-).

Thanks,
Taylor

[1]: https://lore.kernel.org/git/patch-1.1-deb65805345-20221206T195811Z-avarab@gmail.com/

```

## Taylor Blau, 2022-12-07 22:40

Subject: Re: [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows
Message-ID: <Y5EWUNbR1X+GrrNs@nand.local>
URL: https://gitlist.dev/e/Y5EWUNbR1X%2BGrrNs%40nand.local
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```
On Wed, Dec 07, 2022 at 02:34:36PM +0000, Johannes Schindelin via GitGitGadget wrote:
> Johannes Schindelin (4):
>   ci: use a newer `github-script` version
>   ci: avoid deprecated `set-output` workflow command
>   ci: avoid using deprecated {up,down}load-artifacts Action
>   ci(l10n): avoid using the deprecated `set-output` workflow command

These all look reasonable to me, minus the first one which is already
on 'master' as-is (unless I am missing something, but see my reply to
that email).

Thanks,
Taylor

```

## Ævar Arnfjörð Bjarmason, 2022-12-07 22:42

Subject: Re: [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows
Message-ID: <221207.86r0xa9618.gmgdl@evledraar.gmail.com>
URL: https://gitlist.dev/e/221207.86r0xa9618.gmgdl%40evledraar.gmail.com
In-Reply-To: <pull.1440.git.1670423680.gitgitgadget@gmail.com>

```

On Wed, Dec 07 2022, Johannes Schindelin via GitGitGadget wrote:

> I waited for quite a while with submitting this because I did not want to
> interfere with patch series that are in flight, but it seems that this was
> unwise, as there is now a patch floating about (ab/ci-retire-set-output)
> that partially fulfills this here patch series' purpose. However, these
> patches are more complete, so I proposed to supersede that patch with this
> more comprehensive solution.

What does "more complete" here mean? Just that this series is doing more
things than stand-alone patches?

> This patch series is based on od/ci-use-checkout-v3-when-applicable.
>
> Johannes Schindelin (4):
>   ci: use a newer `github-script` version

Is this the patch that needs or interacts with
od/ci-use-checkout-v3-when-applicable?

I don't see it in "What's Cooking", but "seen" currently has
"gitster/js/ci-set-output", which looks to be from
[1]

>   ci: avoid deprecated `set-output` workflow command

This is byte-for-byte the same as the second hunk in my [2].

>   ci: avoid using deprecated {up,down}load-artifacts Action

Most of this looks good & doesn't duplicate any existing patch, but why
is there a change in there that disables the uploading of failed test
directories for the "linux32" job?

>   ci(l10n): avoid using the deprecated `set-output` workflow command

This does the same as the first hunk in my [2], you're just using two
"echo", I used a here-doc.

I think what would make it valuable to bundle these up is if doing so
would resolve some tricky interference between these patches.

But I don't see that that's the case, and we can e.g. start writing to
"$GITHUB_OUTPUT" independent of other changes.

1. https://lore.kernel.org/git/pull.1387.git.1667902408921.gitgitgadget@gmail.com/
2. https://lore.kernel.org/git/patch-v2-1.1-4e7db0db3be-20221207T014848Z-avarab@gmail.com/

```

## Junio C Hamano, 2022-12-07 23:58

Subject: Re: [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows
Message-ID: <xmqqv8mm4vgu.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqv8mm4vgu.fsf%40gitster.g
In-Reply-To: <Y5EWUNbR1X+GrrNs@nand.local>

```
Taylor Blau <me@ttaylorr.com> writes:

> On Wed, Dec 07, 2022 at 02:34:36PM +0000, Johannes Schindelin via GitGitGadget wrote:
>> Johannes Schindelin (4):
>>   ci: use a newer `github-script` version
>>   ci: avoid deprecated `set-output` workflow command
>>   ci: avoid using deprecated {up,down}load-artifacts Action
>>   ci(l10n): avoid using the deprecated `set-output` workflow command
>
> These all look reasonable to me, minus the first one which is already
> on 'master' as-is (unless I am missing something, but see my reply to
> that email).

I think we already have set-output ones figured out and queued in
'seen', and the third one alone cleanly applies without any others
(and replaces my botched attempt ;-), so we are in good shape, I
think.

Thanks.

```

## Junio C Hamano, 2022-12-08 05:50

Subject: Re: [PATCH 0/4] Avoid using deprecated features in Git's GitHub workflows
Message-ID: <xmqqh6y64f5v.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqh6y64f5v.fsf%40gitster.g
In-Reply-To: <xmqqv8mm4vgu.fsf@gitster.g>

```
Junio C Hamano <gitster@pobox.com> writes:

> Taylor Blau <me@ttaylorr.com> writes:
>
>> On Wed, Dec 07, 2022 at 02:34:36PM +0000, Johannes Schindelin via GitGitGadget wrote:
>>> Johannes Schindelin (4):
>>>   ci: use a newer `github-script` version
>>>   ci: avoid deprecated `set-output` workflow command
>>>   ci: avoid using deprecated {up,down}load-artifacts Action
>>>   ci(l10n): avoid using the deprecated `set-output` workflow command
>>
>> These all look reasonable to me, minus the first one which is already
>> on 'master' as-is (unless I am missing something, but see my reply to
>> that email).
>
> I think we already have set-output ones figured out and queued in
> 'seen', and the third one alone cleanly applies without any others
> (and replaces my botched attempt ;-), so we are in good shape, I
> think.

So, with "checkout@v3" by Oscar a few days ago, "set-output to
$GITHUB_OUTPUT" by Ævar yesterday, and the "upload/download
artifact@v3" in this series, all queued near the tip of 'next', all
the deprecation warnings we have been seeing are now gone, cf.

  https://github.com/git/git/actions/runs/3644168470

Unfortunately, a new one says that ubuntu-22.04 will soon be used
when ubuntu-latest is called for X-<.

In any case, thank you, everybody, for cleaning up the CI workers.


```
