Skip to contentSkip to conversation

CI: migrate away from deprecated "set-output" syntax

PATCH Superseded Ævar Arnfjörð Bjarmason 4 participants 9 messages Dec 6, 2022 – Dec 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CI: migrate away from deprecated "set-output" syntax

As noted in [1] and the warnings the CI itself is spewing echoing outputs to stdout is deprecated, and they should be written to "$GITHUB_OUTPUT" instead.

1. https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

---

Along with my just-sent
https://lore.kernel.org/git/[email protected]/
and Junio's https://lore.kernel.org/git/[email protected]/
this should make our CI warning free.

 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.github/workflows/main.yml +1 -1
index 9afacfa0b33..d1e16009b11 100644
@@ -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
Signature · 1 line
2.39.0.rc2.1017.g5f0c708352f
#1 lore raw
Quoted 5 lines · Ævar Arnfjörð Bjarmason

As noted in [1] and the warnings the CI itself is spewing echoing outputs to stdout is deprecated, and they should be written to "$GITHUB_OUTPUT" instead.

1. https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Interesting, I didn't realize this changed! The new syntax is certainly much nicer to read.

Quoted 11 lines

---

Along with my just-sent
https://lore.kernel.org/git/[email protected]/
and Junio's https://lore.kernel.org/git/[email protected]/
this should make our CI warning free.

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

Should this also be updated for 'l10n.yml'? There are two usages of '::set-output' there as well.

.github/workflows/main.yml jobs: · line 37

Quoted 11 lines
.github/workflows/main.yml +1 -1
index 9afacfa0b33..d1e16009b11 100644
@@ -34,7 +34,7 @@ jobs:
           then
             enabled=no
           fi
-          echo "::set-output name=enabled::$enabled"
+          echo "enabled=$enabled" >>$GITHUB_OUTPUT

Looks good!

Quoted 3 lines
.github/workflows/main.yml +0 -0
       - name: skip if the commit or tree was already tested
         id: skip-if-redundant
         uses: actions/github-script@v6
#2 lore raw
Quoted 11 lines · Victoria Dye

Ævar Arnfjörð Bjarmason wrote:
[...]

Quoted 9 lines

---

Along with my just-sent
https://lore.kernel.org/git/[email protected]/
and Junio's https://lore.kernel.org/git/[email protected]/
this should make our CI warning free.

Quoted 5 lines
Quoted 2 lines
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Should this also be updated for 'l10n.yml'? There are two usages of '::set-output' there as well.

Yes, I just missed that one. I'll fix that, but will wait a bit to see if there's any other comments first. Thanks!

#3 lore raw
Quoted 5 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines

Should this also be updated for 'l10n.yml'? There are two usages of '::set-output' there as well.

Yes, I just missed that one. I'll fix that, but will wait a bit to see if there's any other comments first. Thanks!

No concerns from me. I noticed this warning when I was looking at all of the CI builds a few weeks ago.

This transition looks obviously correct to me, and as long as we apply it in the l10n workflow as Victoria mentions, this should be good to go.

Thanks,
Taylor

#4 lore raw

PATCH v2 1/1 CI: migrate away from deprecated "set-output" syntax

In reply to Ævar Arnfjörð Bjarmason

As noted in [1] and the warnings the CI itself is spewing echoing outputs to stdout is deprecated, and they should be written to "$GITHUB_OUTPUT" instead.

1. https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

---
Range-diff against v1:
1: deb65805345 ! 1: 4e7db0db3be CI: migrate away from deprecated "set-output" syntax
@@ Commit message

+ ## .github/workflows/l10n.yml ##
+@@ .github/workflows/l10n.yml: jobs:
+ base=${{ github.event.before }}
+ head=${{ github.event.after }}
+ fi
+- echo "::set-output name=base::$base"
+- echo "::set-output name=head::$head"
++ cat >>$GITHUB_OUTPUT <<-EOF
++ base=$base
++ head=$head
++ EOF
+ - name: Run partial clone
+ run: |
+ git -c init.defaultBranch=master init --bare .
+
## .github/workflows/main.yml ##
@@ .github/workflows/main.yml: jobs:
then

 .github/workflows/l10n.yml | 6 ++++--
 .github/workflows/main.yml | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
.github/workflows/l10n.yml +4 -2
index 27f72f0ff34..8fa073db2dc 100644
@@ -23,8 +23,10 @@ jobs:
             base=${{ github.event.before }}
             head=${{ github.event.after }}
           fi
-          echo "::set-output name=base::$base"
-          echo "::set-output name=head::$head"
+          cat >>$GITHUB_OUTPUT <<-EOF
+          base=$base
+          head=$head
+          EOF
       - name: Run partial clone
         run: |
           git -c init.defaultBranch=master init --bare .
.github/workflows/main.yml +1 -1
index 9afacfa0b33..d1e16009b11 100644
@@ -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
Signature · 1 line
2.39.0.rc2.1019.gce04d262ea9
#5 lore raw
Quoted 6 lines · Ævar Arnfjörð Bjarmason
    +-          echo "::set-output name=base::$base"
    +-          echo "::set-output name=head::$head"
    ++          cat >>$GITHUB_OUTPUT <<-EOF
    ++          base=$base
    ++          head=$head
    ++          EOF

Hmph, I do not trust this part.

The redirection operator "<<-" causes the leading tabs in the here-doc-text stripped, but the .yml file does not indent with tab to begin with.

I suspect the leading spaces will all be stripped and not seen by the shell, so the distinction may not matter, which means the use of "<<-" is very much misleading.

Let's stick to the dumb and proven

echo "base=$base" >>$GITHUB_OUTPUT
echo "head=$head" >>$GITHUB_OUTPUT

instead, which is used throughout the rewrite in this patch.

#6 lore raw
Quoted 19 lines · Junio C Hamano
Quoted 6 lines · Ævar Arnfjörð Bjarmason
    +-          echo "::set-output name=base::$base"
    +-          echo "::set-output name=head::$head"
    ++          cat >>$GITHUB_OUTPUT <<-EOF
    ++          base=$base
    ++          head=$head
    ++          EOF

Hmph, I do not trust this part.

The redirection operator "<<-" causes the leading tabs in the here-doc-text stripped, but the .yml file does not indent with tab to begin with.

I suspect the leading spaces will all be stripped and not seen by the shell, so the distinction may not matter, which means the use of "<<-" is very much misleading.

Quoted 6 lines

Let's stick to the dumb and proven

echo "base=$base" >>$GITHUB_OUTPUT
echo "head=$head" >>$GITHUB_OUTPUT

instead, which is used throughout the rewrite in this patch.

Sure, I'll re-roll with that.

#7 lore raw
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 6 lines

Let's stick to the dumb and proven

echo "base=$base" >>$GITHUB_OUTPUT
echo "head=$head" >>$GITHUB_OUTPUT

instead, which is used throughout the rewrite in this patch.

Sure, I'll re-roll with that.

Ah, no need. I've already amended the one under discussion and it is in 'next' together with the last bit from Johannes to use the updated upload/download artifact Action.

Thanks.

#8 lore raw

PATCH v3 1/1 CI: migrate away from deprecated "set-output" syntax

In reply to Ævar Arnfjörð Bjarmason

As noted in [1] and the warnings the CI itself is spewing echoing outputs to stdout is deprecated, and they should be written to "$GITHUB_OUTPUT" instead.

1. https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

---
Range-diff against v2:
1: 4e7db0db3be ! 1: 0519cc1105a CI: migrate away from deprecated "set-output" syntax
@@ .github/workflows/l10n.yml: jobs:
fi
- echo "::set-output name=base::$base"
- echo "::set-output name=head::$head"
-+ cat >>$GITHUB_OUTPUT <<-EOF
-+ base=$base
-+ head=$head
-+ EOF
++ echo "base=$base" >>$GITHUB_OUTPUT
++ echo "head=$head" >>$GITHUB_OUTPUT
- name: Run partial clone
run: |
git -c init.defaultBranch=master init --bare .

 .github/workflows/l10n.yml | 4 ++--
 .github/workflows/main.yml | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
.github/workflows/l10n.yml +2 -2
index 27f72f0ff34..2915c595b4f 100644
@@ -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 .
.github/workflows/main.yml +1 -1
index 9afacfa0b33..d1e16009b11 100644
@@ -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
Signature · 1 line
2.39.0.rc2.1019.gce04d262ea9