fix action 3
This commit is contained in:
parent
a9c48ef418
commit
da18756460
1 changed files with 28 additions and 7 deletions
|
|
@ -29,10 +29,19 @@ jobs:
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: changes
|
id: changes
|
||||||
run: |
|
run: |
|
||||||
|
echo "DEBUG: GITHUB_OUTPUT='${GITHUB_OUTPUT:-<unset>}'"
|
||||||
|
echo "DEBUG: Checking if GITHUB_OUTPUT var is set: $(if [ -z "${GITHUB_OUTPUT+x}" ]; then echo "NOT SET"; else echo "SET (value: '$GITHUB_OUTPUT')"; fi)"
|
||||||
|
|
||||||
|
set_output() {
|
||||||
|
echo "::set-output name=$1::$2"
|
||||||
|
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||||
|
echo "$1=$2" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
}
|
||||||
if git diff --quiet flake.lock; then
|
if git diff --quiet flake.lock; then
|
||||||
echo "changed=false" >> $GITHUB_OUTPUT
|
set_output changed false
|
||||||
else
|
else
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
set_output changed true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Extract LXC hosts
|
- name: Extract LXC hosts
|
||||||
|
|
@ -40,6 +49,14 @@ jobs:
|
||||||
if: steps.changes.outputs.changed == 'true'
|
if: steps.changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
set_output() {
|
||||||
|
echo "::set-output name=$1::$2"
|
||||||
|
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||||
|
echo "$1=$2" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
HOSTS=$(nix eval --json .#colmena --apply 'x: builtins.filter (n: n != "meta" && builtins.elem "lxc" (x.${n}.deployment.tags or [])) (builtins.attrNames x)' 2>&1) || {
|
HOSTS=$(nix eval --json .#colmena --apply 'x: builtins.filter (n: n != "meta" && builtins.elem "lxc" (x.${n}.deployment.tags or [])) (builtins.attrNames x)' 2>&1) || {
|
||||||
echo "Failed to evaluate colmena hosts"
|
echo "Failed to evaluate colmena hosts"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -47,16 +64,20 @@ jobs:
|
||||||
# Validate the output is a non-empty JSON array
|
# Validate the output is a non-empty JSON array
|
||||||
if ! echo "$HOSTS" | jq -e '. | if type == "array" and length > 0 then true else false end' > /dev/null 2>&1; then
|
if ! echo "$HOSTS" | jq -e '. | if type == "array" and length > 0 then true else false end' > /dev/null 2>&1; then
|
||||||
echo "Error: No LXC hosts found or invalid JSON output: $HOSTS"
|
echo "Error: No LXC hosts found or invalid JSON output: $HOSTS"
|
||||||
echo "hosts=[]" >> $GITHUB_OUTPUT
|
set_output hosts "[]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "hosts=$HOSTS" >> $GITHUB_OUTPUT
|
|
||||||
|
set_output hosts "$HOSTS"
|
||||||
echo "Discovered hosts: $HOSTS"
|
echo "Discovered hosts: $HOSTS"
|
||||||
# Also write to file as backup (in case job outputs don't work)
|
# Also write to file as backup (in case job outputs don't work)
|
||||||
echo "$HOSTS" > hosts.json
|
echo "$HOSTS" > hosts.json
|
||||||
# Verify output was set
|
# Debug output
|
||||||
echo "DEBUG: GITHUB_OUTPUT contents:"
|
echo "DEBUG: GITHUB_OUTPUT exists: ${GITHUB_OUTPUT:-NOT SET}"
|
||||||
cat $GITHUB_OUTPUT
|
if [ -n "${GITHUB_OUTPUT:-}" ] && [ -f "$GITHUB_OUTPUT" ]; then
|
||||||
|
echo "DEBUG: GITHUB_OUTPUT contents:"
|
||||||
|
cat "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Debug job outputs
|
- name: Debug job outputs
|
||||||
if: steps.changes.outputs.changed == 'true'
|
if: steps.changes.outputs.changed == 'true'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue