Skip to content

Commit

Permalink
gha: replace set-output with append to output file
Browse files Browse the repository at this point in the history
This patch replaces setting output using `echo set-output` with appending to
`$GITHUB_OUTPUT`. Details can be found
[here](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/).
  • Loading branch information
joostvanzwieten committed Dec 1, 2022
1 parent 6ca182b commit c059e78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# the) generated wheels to the date of the commit.
export SOURCE_DATE_EPOCH=`git show -s --format=%ct`
python3 -m flit build
printf "::set-output name=wheel::%s" dist/*.whl
echo wheel=`echo dist/*.whl` >> $GITHUB_OUTPUT
- name: Upload package artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
4 changes: 3 additions & 1 deletion devtools/_log_gha.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
from pathlib import Path
from typing import Any

debug = print
Expand All @@ -21,5 +23,5 @@ def error(*args: Any) -> None:


def set_output(key: str, value: str) -> None:
print('::set-output name={}::{}'.format(key, value))
Path(os.environ['GITHUB_OUTPUT']).open('a').write(f'{key}={value}\n')
print('\033[1;35mOUTPUT: {}={}\033[0m'.format(key, value))

0 comments on commit c059e78

Please sign in to comment.