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

Replace set-output usage with GITHUB_OUTPUT #252

Merged
Show file tree
Hide file tree
Changes from 2 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 README.md
Expand Up @@ -345,7 +345,7 @@ The steps in your workflow might look like this:
- name: Get last commit message
id: last-commit-message
run: |
echo "::set-output name=msg::$(git log -1 --pretty=%s)"
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT

- uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Expand Up @@ -11,7 +11,7 @@ _main() {

if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then

echo "::set-output name=changes_detected::true";
echo "changes_detected=true" >> $GITHUB_OUTPUT;

_switch_to_branch

Expand All @@ -24,7 +24,7 @@ _main() {
_push_to_github
else

echo "::set-output name=changes_detected::false";
echo "changes_detected=false" >> $GITHUB_OUTPUT;

echo "Working tree clean. Nothing to commit.";
fi
Expand Down Expand Up @@ -101,7 +101,7 @@ _local_commit() {
--author="$INPUT_COMMIT_AUTHOR" \
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};

echo "::set-output name=commit_hash::$(git rev-parse HEAD)";
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT;
}

_tag_commit() {
Expand Down
38 changes: 19 additions & 19 deletions tests/git-auto-commit.bats
Expand Up @@ -87,8 +87,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
amonshiz marked this conversation as resolved.
Show resolved Hide resolved
assert_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: master"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand All @@ -108,8 +108,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: master"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand All @@ -131,8 +131,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::false"
refute_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=false" >> $GITHUB_OUTPUT'
refute_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "Working tree clean. Nothing to commit."
}

Expand All @@ -142,8 +142,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::false"
refute_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=false" >> $GITHUB_OUTPUT'
refute_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "Working tree clean. Nothing to commit."
}

Expand All @@ -155,8 +155,8 @@ git_auto_commit() {
assert_failure

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
refute_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
refute_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: master"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand Down Expand Up @@ -504,7 +504,7 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::false"
assert_line '"changes_detected=false" >> $GITHUB_OUTPUT'

run git status
assert_output --partial 'nothing to commit, working tree clean'
Expand Down Expand Up @@ -532,7 +532,7 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line "::debug::Push commit to remote branch dev"
}

Expand All @@ -553,7 +553,7 @@ git_auto_commit() {
assert_failure

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: not-existend-branch"
assert_line "fatal: invalid reference: not-existend-branch"

Expand Down Expand Up @@ -581,8 +581,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: not-existend-branch"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand Down Expand Up @@ -621,8 +621,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: not-existend-remote-branch"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand Down Expand Up @@ -675,8 +675,8 @@ git_auto_commit() {
assert_success

assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
assert_line "::set-output name=changes_detected::true"
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
assert_line '"changes_detected=true" >> $GITHUB_OUTPUT'
assert_line -e '"commit_hash=[0-9a-f]{40}$" >> $GITHUB_OUTPUT'
assert_line "INPUT_BRANCH value: existing-remote-branch"
assert_line "INPUT_FILE_PATTERN: ."
assert_line "INPUT_COMMIT_OPTIONS: "
Expand Down