Fallback to set-output if GITHUB_OUTPUT not available

This commit is contained in:
Stefan Zweifel 2022-10-26 18:42:01 +02:00
parent f6f7a9c351
commit 684858bfef
1 changed files with 22 additions and 3 deletions

View File

@ -11,7 +11,13 @@ _main() {
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then
echo "changes_detected=true" >> $GITHUB_OUTPUT;
# Check if $GITHUB_OUTPUT is available
# (Feature detection will be removed in late December 2022)
if [ -z ${GITHUB_OUTPUT+x} ]; then
echo "::set-output name=changes_detected::true";
else
echo "changes_detected=true" >> $GITHUB_OUTPUT;
fi
_switch_to_branch
@ -24,7 +30,13 @@ _main() {
_push_to_github
else
echo "changes_detected=false" >> $GITHUB_OUTPUT;
# Check if $GITHUB_OUTPUT is available
# (Feature detection will be removed in late December 2022)
if [ -z ${GITHUB_OUTPUT+x} ]; then
echo "::set-output name=changes_detected::false";
else
echo "changes_detected=false" >> $GITHUB_OUTPUT;
fi
echo "Working tree clean. Nothing to commit.";
fi
@ -101,7 +113,14 @@ _local_commit() {
--author="$INPUT_COMMIT_AUTHOR" \
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT;
# Check if $GITHUB_OUTPUT is available
# (Feature detection will be removed in late December 2022)
if [ -z ${GITHUB_OUTPUT+x} ]; then
echo "::set-output name=commit_hash::$(git rev-parse HEAD)";
else
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT;
fi
}
_tag_commit() {