Use deprecated set-output syntax if GITHUB_OUTPUT environment is not available (#255)

* Fallback to set-output if GITHUB_OUTPUT not available

* Add Tests to cover old syntax
This commit is contained in:
Stefan Zweifel
2022-10-26 18:55:42 +02:00
committed by GitHub
parent f6f7a9c351
commit 0049e3fa40
2 changed files with 67 additions and 4 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() {