Avoid using deprecated features in Git's GitHub workflows
cover Avoid using deprecated features in Git's GitHub workflows
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/[email protected]/,
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
Signature · 1 line
gitgitgadget
PATCH 1/4 ci: use a newer `github-script` version
From: Johannes Schindelin <[email protected]>
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.
--- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
.github/workflows/main.yml +3 -3
@@ -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,
Signature · 1 line
gitgitgadget
Re: [PATCH 1/4] ci: use a newer `github-script` version
Quoted 11 lines · Johannes Schindelin via GitGitGadget
From: Johannes Schindelin <[email protected]>
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 thegithub-scriptAction uses the recommended new way to specify outputs.Signed-off-by Johannes Schindelin <[email protected]>Signed-off-by Taylor Blau <[email protected]>
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
PATCH 2/4 ci: avoid deprecated `set-output` workflow command
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
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/
--- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.github/workflows/main.yml +1 -1
@@ -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
gitgitgadget
Re: [PATCH 2/4] ci: avoid deprecated `set-output` workflow command
Quoted 5 lines · Johannes Schindelin via GitGitGadget
From: Johannes Schindelin <[email protected]>
Due to security concerns, this command was deprecated and we need to write into
$GITHUB_OUTPUTinstead. 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
PATCH 3/4 ci: avoid using deprecated {up,down}load-artifacts Action
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
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.
--- .github/workflows/main.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
.github/workflows/main.yml +14 -8
@@ -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}}
Signature · 1 line
gitgitgadget
PATCH 4/4 ci(l10n): avoid using the deprecated `set-output` workflow command
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
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/
--- .github/workflows/l10n.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
.github/workflows/l10n.yml +2 -2
@@ -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 .
Signature · 1 line
gitgitgadget
Quoted 5 lines · Johannes Schindelin via GitGitGadget
Johannes Schindelin (4):
ci: use a newergithub-scriptversion
ci: avoid deprecatedset-outputworkflow command
ci: avoid using deprecated {up,down}load-artifacts Action ci(l10n): avoid using the deprecatedset-outputworkflow 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
Quoted 10 lines · Taylor Blau
Quoted 5 lines · Johannes Schindelin via GitGitGadget
Johannes Schindelin (4):
ci: use a newergithub-scriptversion
ci: avoid deprecatedset-outputworkflow command
ci: avoid using deprecated {up,down}load-artifacts Action ci(l10n): avoid using the deprecatedset-outputworkflow commandThese 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.
Quoted 9 lines · Junio C Hamano
Quoted 7 lines · Taylor Blau
Quoted 5 lines · Johannes Schindelin via GitGitGadget
Johannes Schindelin (4):
ci: use a newergithub-scriptversion
ci: avoid deprecatedset-outputworkflow command
ci: avoid using deprecated {up,down}load-artifacts Action ci(l10n): avoid using the deprecatedset-outputworkflow command
Quoted 8 lines
Quoted 3 lines
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.
Quoted 6 lines · Johannes Schindelin via GitGitGadget
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?
Quoted 4 lines
This patch series is based on od/ci-use-checkout-v3-when-applicable.
Johannes Schindelin (4):
ci: use a newergithub-scriptversion
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]
Quoted 1 line
ci: avoid deprecated
set-outputworkflow command
This is byte-for-byte the same as the second hunk in my [2].
Quoted 1 line
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?
Quoted 1 line
ci(l10n): avoid using the deprecated
set-outputworkflow 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/[email protected]/
2. https://lore.kernel.org/git/[email protected]/