Skip to content

Commit

Permalink
feat: add support for writing to GITHUB_OUTPUT file (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Oct 16, 2022
1 parent dfdf43d commit a3391b5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,23 @@ if [[ -n "$CHANGED_FILES" ]]; then
echo "Found uncommited changes"

CHANGED_FILES=$(echo "$CHANGED_FILES" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')

echo "::set-output name=files_changed::true"
echo "::set-output name=changed_files::$CHANGED_FILES"

if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=files_changed::true"
echo "::set-output name=changed_files::$CHANGED_FILES"
else
echo "files_changed=true" >> "$GITHUB_OUTPUT"
echo "changed_files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
fi

else
echo "No changes found."
echo "::set-output name=files_changed::false"

if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=files_changed::false"
else
echo "files_changed=false" >> "$GITHUB_OUTPUT"
fi
fi

echo "::endgroup::"

0 comments on commit a3391b5

Please sign in to comment.