Skip to content

Commit 22afb71

Browse files
committed
GHA: switch from set-output to env file.
The set-output mechanism is deprecated for security reasons so set environment variable outputs in GITHUB_OUTPUT instead. Change get-ci-matrix.py to output the env file settings to stdout and move all debug output to stderr. Also, add build-push summary statements for the workflow if the GITHUB_STEP_SUMMARY variable is set.
1 parent b113435 commit 22afb71

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
get-matrix:
1919
runs-on: ubuntu-24.04
2020
outputs:
21-
do-linux: ${{ steps.get-matrix-step.outputs.do-linux }}
21+
do-linux: ${{ steps.get-matrix-step.outputs.do_linux }}
2222
matrix-linux: ${{ steps.get-matrix-step.outputs.linux }}
23-
do-macos: ${{ steps.get-matrix-step.outputs.do-macos }}
23+
do-macos: ${{ steps.get-matrix-step.outputs.do_macos }}
2424
matrix-macos: ${{ steps.get-matrix-step.outputs.macos }}
2525
steps:
2626
- uses: actions/checkout@v4
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
export OVERRIDE_IMPLS="${{ github.event.inputs.impls }}" # "
3333
echo "OVERRIDE_IMPLS: ${OVERRIDE_IMPLS}"
34-
./get-ci-matrix.py ${{ steps.files.outputs.all }}
34+
./get-ci-matrix.py ${{ steps.files.outputs.all }} > "${GITHUB_OUTPUT}"
3535
3636
linux:
3737
needs: get-matrix

ci.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ echo "MAKE: ${MAKE}"
6363

6464
case "${ACTION}" in
6565
docker-build-push)
66-
if ! docker pull ${IMAGE}; then
66+
if docker pull ${IMAGE}; then
67+
[ "${GITHUB_STEP_SUMMARY}" ] && \
68+
echo "${MAL_IMPL:-${IMPL}} - pulled ${IMAGE}"
69+
else
6770
make "docker-build^${MAL_IMPL:-${IMPL}}"
71+
[ "${GITHUB_STEP_SUMMARY}" ] && \
72+
echo "${MAL_IMPL:-${IMPL}} - built ${IMAGE}"
6873
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
6974
docker push ${IMAGE}
75+
[ "${GITHUB_STEP_SUMMARY}" ] && \
76+
echo "${MAL_IMPL:-${IMPL}} - pushed ${IMAGE}"
7077
fi
7178
fi
7279
;;

get-ci-matrix.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
OVERRIDE_IMPLS = os.environ.get('OVERRIDE_IMPLS', '').split()
1414

15+
def eprint(*args, **kwargs):
16+
print(*args, file=sys.stderr, **kwargs)
17+
1518
def impl_text(impl):
1619
s = "IMPL=%s" % impl['IMPL']
1720
for k, v in impl.items():
@@ -37,11 +40,11 @@ def impl_text(impl):
3740
do_full = True
3841

3942

40-
print("OVERRIDE_IMPLS: %s" % OVERRIDE_IMPLS)
41-
print("code_changes: %s (%d)" % (code_changes, len(code_changes)))
42-
print("impl_changes: %s (%d)" % (impl_changes, len(impl_changes)))
43-
print("run_impls: %s (%d)" % (run_impls, len(run_impls)))
44-
print("do_full: %s" % do_full)
43+
eprint("OVERRIDE_IMPLS: %s" % OVERRIDE_IMPLS)
44+
eprint("code_changes: %s (%d)" % (code_changes, len(code_changes)))
45+
eprint("impl_changes: %s (%d)" % (impl_changes, len(impl_changes)))
46+
eprint("run_impls: %s (%d)" % (run_impls, len(run_impls)))
47+
eprint("do_full: %s" % do_full)
4548

4649
# Load the full implementation description file
4750
all_impls = yaml.safe_load(open(IMPLS_FILE))
@@ -60,7 +63,7 @@ def impl_text(impl):
6063
elif do_full:
6164
targ.append(impl_text(impl))
6265

63-
print("::set-output name=do-linux::%s" % json.dumps(len(linux_impls)>0))
64-
print("::set-output name=do-macos::%s" % json.dumps(len(macos_impls)>0))
65-
print("::set-output name=linux::{\"IMPL\":%s}" % json.dumps(linux_impls))
66-
print("::set-output name=macos::{\"IMPL\":%s}" % json.dumps(macos_impls))
66+
print("do_linux=%s" % json.dumps(len(linux_impls)>0))
67+
print("do_macos=%s" % json.dumps(len(macos_impls)>0))
68+
print("linux='{\"IMPL\":%s}'" % json.dumps(linux_impls))
69+
print("macos='{\"IMPL\":%s}'" % json.dumps(macos_impls))

0 commit comments

Comments
 (0)