Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use >>$GITHUB_OUTPUT instead of ::set-output #679

Merged
merged 8 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/manual-matrix-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
echo '${{ steps.changed-files.outputs.all_changed_files }}'

- id: set-matrix
run: echo "::set-output name=matrix::{\"container\":${{ steps.changed-files.outputs.all_changed_files }}}"
run: echo "matrix={\"container\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"

matrix-job:
name: Run Matrix Job
Expand Down
10 changes: 6 additions & 4 deletions diff-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ if [[ -n "$PREVIOUS_SHA" && -n "$CURRENT_SHA" && "$PREVIOUS_SHA" == "$CURRENT_SH
exit 1
fi

echo "::set-output name=target_branch::$TARGET_BRANCH"
echo "::set-output name=current_branch::$CURRENT_BRANCH"
echo "::set-output name=previous_sha::$PREVIOUS_SHA"
echo "::set-output name=current_sha::$CURRENT_SHA"
cat <<EOF >> "$GITHUB_OUTPUT"
target_branch=$TARGET_BRANCH
current_branch=$CURRENT_BRANCH
previous_sha=$PREVIOUS_SHA
current_sha=$CURRENT_SHA
EOF

echo "::endgroup::"
4 changes: 2 additions & 2 deletions get-base-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [[ -n "$INPUT_SINCE" ]]; then
if [[ -z "$BASE_SHA" ]]; then
echo "::warning::The BASE_SHA for date '$INPUT_SINCE' couldn't be determined."
fi
echo "::set-output name=base_sha::$BASE_SHA"
echo "base_sha=$BASE_SHA" >> "$GITHUB_OUTPUT"
elif [[ -n "$INPUT_BASE_SHA" ]]; then
echo "::set-output name=base_sha::$INPUT_BASE_SHA"
echo "base_sha=$INPUT_BASE_SHA" >> "$GITHUB_OUTPUT"
fi
56 changes: 29 additions & 27 deletions get-changed-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ else

if [[ -n "${ALL_CHANGED}" ]]; then
echo "::debug::Matching changed files: ${ALL_CHANGED}"
echo "::set-output name=any_changed::true"
echo "any_changed=true" >> "$GITHUB_OUTPUT"
else
echo "::set-output name=any_changed::false"
echo "any_changed=false" >> "$GITHUB_OUTPUT"
fi

OTHER_CHANGED=""
Expand All @@ -154,19 +154,19 @@ else

if [[ -n "${OTHER_CHANGED}" && "${OTHER_CHANGED}" != "[]" ]]; then
echo "::debug::Non Matching changed files: ${OTHER_CHANGED}"
echo "::set-output name=only_changed::false"
echo "::set-output name=other_changed_files::$OTHER_CHANGED"
echo "only_changed=false" >> "$GITHUB_OUTPUT"
echo "other_changed_files=$OTHER_CHANGED" >> "$GITHUB_OUTPUT"
elif [[ -n "${ALL_CHANGED}" ]]; then
echo "::set-output name=only_changed::true"
echo "only_changed=true" >> "$GITHUB_OUTPUT"
fi

ALL_OTHER_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')

if [[ -n "${ALL_MODIFIED}" ]]; then
echo "::debug::Matching modified files: ${ALL_MODIFIED}"
echo "::set-output name=any_modified::true"
echo "any_modified=true" >> "$GITHUB_OUTPUT"
else
echo "::set-output name=any_modified::false"
echo "any_modified=false" >> "$GITHUB_OUTPUT"
fi

OTHER_MODIFIED=""
Expand All @@ -187,19 +187,19 @@ else

if [[ -n "${OTHER_MODIFIED}" && "$OTHER_MODIFIED" != "[]" ]]; then
echo "::debug::Non Matching modified files: ${OTHER_MODIFIED}"
echo "::set-output name=only_modified::false"
echo "::set-output name=other_modified_files::$OTHER_MODIFIED"
echo "only_modified=false" >> "$GITHUB_OUTPUT"
echo "other_modified_files=$OTHER_MODIFIED" >> "$GITHUB_OUTPUT"
elif [[ -n "${ALL_MODIFIED}" ]]; then
echo "::set-output name=only_modified::true"
echo "only_modified=true" >> "$GITHUB_OUTPUT"
fi

ALL_OTHER_DELETED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" D | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')

if [[ -n "${DELETED}" ]]; then
echo "::debug::Matching deleted files: ${DELETED}"
echo "::set-output name=any_deleted::true"
echo "any_deleted=true" >> "$GITHUB_OUTPUT"
else
echo "::set-output name=any_deleted::false"
echo "any_deleted=false" >> "$GITHUB_OUTPUT"
fi

OTHER_DELETED=""
Expand All @@ -220,10 +220,10 @@ else

if [[ -n "${OTHER_DELETED}" && "${OTHER_DELETED}" != "[]" ]]; then
echo "::debug::Non Matching deleted files: ${OTHER_DELETED}"
echo "::set-output name=only_deleted::false"
echo "::set-output name=other_deleted_files::$OTHER_DELETED"
echo "only_deleted=false" >> "$GITHUB_OUTPUT"
echo "other_deleted_files=$OTHER_DELETED" >> "$GITHUB_OUTPUT"
elif [[ -n "${DELETED}" ]]; then
echo "::set-output name=only_deleted::true"
echo "only_deleted=true" >> "$GITHUB_OUTPUT"
fi
if [[ "$INPUT_JSON" == "false" ]]; then
ADDED=$(echo "${ADDED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
Expand Down Expand Up @@ -267,19 +267,21 @@ if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
echo "::debug::All old & new renamed files: $ALL_OLD_NEW_RENAMED"
fi

echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=type_changed_files::$TYPE_CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED"
cat <<EOF >> "$GITHUB_OUTPUT"
added_files=$ADDED
copied_files=$COPIED
deleted_files=$DELETED
modified_files=$MODIFIED
renamed_files=$RENAMED
type_changed_files=$TYPE_CHANGED
unmerged_files=$UNMERGED
unknown_files=$UNKNOWN
all_changed_and_modified_files=$ALL_CHANGED_AND_MODIFIED
all_changed_files=$ALL_CHANGED
all_modified_files=$ALL_MODIFIED
EOF
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
echo "::set-output name=all_old_new_renamed_files::$ALL_OLD_NEW_RENAMED"
echo "all_old_new_renamed_files=$ALL_OLD_NEW_RENAMED" >> "$GITHUB_OUTPUT"
fi

echo "::endgroup::"
4 changes: 2 additions & 2 deletions get-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [[ -n "$INPUT_UNTIL" ]]; then
if [[ -z "$SHA" ]]; then
echo "::warning::The SHA for date '$INPUT_UNTIL' couldn't be determined, falling back to the current sha."
fi
echo "::set-output name=sha::$SHA"
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
else
echo "::set-output name=sha::$INPUT_SHA"
echo "sha=$INPUT_SHA" >> "$GITHUB_OUTPUT"
fi