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

Conversation

amonshiz
Copy link
Contributor

@amonshiz amonshiz commented Oct 20, 2022

See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ and the recommended migration.

Should fix #250.

This should prevent warnings (and in the future errors) appearing in GitHub summaries.

Generated using fastmod

; fastmod 'echo "::set-output name=([[:alnum:]\-_]+)::(.*)"' 'echo "${1}=${2}" >> $$GITHUB_OUTPUT'
; fastmod 'assert_line "::set-output name=([[:alnum:]\-_]+)::(.*)"' 'assert_line \'"${1}=${2}" >> $$GITHUB_OUTPUT\''
; fastmod 'assert_line -e "::set-output name=([[:alnum:]\-_]+)::(.*)"' 'assert_line -e \'"${1}=${2}" >> $$GITHUB_OUTPUT\''
; fastmod 'refute_line "::set-output name=([[:alnum:]\-_]+)::(.*)"' 'refute_line \'"${1}=${2}" >> $$GITHUB_OUTPUT\''

Before
CleanShot 2022-10-20 at 21 15 11@2x

After
CleanShot 2022-10-20 at 21 15 52@2x

@stefanzweifel
Copy link
Owner

stefanzweifel commented Oct 21, 2022

Thanks Andrew! LGTM.
Will do some testing in my own test repos in the next couple of days and merge and release this.

(BTW: Great work with the Arc browser. Love it more and more. ❤️ )

@amonshiz
Copy link
Contributor Author

Hopefully I fixed the tests :) I’m not the world’s best shell programmer so I just kinda yolo’d it on the test updates.

And thank you for the kind words about Arc! I’m so happy to hear you love it!

tests/git-auto-commit.bats Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
Copy link
Owner

@stefanzweifel stefanzweifel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supberb work, Andrew. 👏

Tests in my own repos also show no regression.
Will merge this to master and tag a new version soon.
(Still have to decide, if this is just a patch release or a major release. Others mentioned that GitHub Enterprise workers need updating: #246 (comment) 🤔 )

Comment on lines +12 to +20
# While it is likely the GitHub hosted runners will use master as the default branch,
# locally anyone may change that. So for tests lets grab whatever is currently set
# globally. This should also ensure that changes to the GitHub hosted runners'
# config do not break tests in the future.
if [[ -z $(git config init.defaultBranch) ]]; then
git config --global init.defaultBranch "main"
fi

export FAKE_DEFAULT_BRANCH=$(git config init.defaultBranch)
Copy link
Owner

@stefanzweifel stefanzweifel Oct 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. 👏
I think on my machine I added a config that repos under the path always use master as the default branch.
As nobody else run these tests before, this didn't come up.

Thanks for the fix.

tests/git-auto-commit.bats Show resolved Hide resolved
@stefanzweifel stefanzweifel merged commit 2fde6fc into stefanzweifel:master Oct 22, 2022
@amonshiz
Copy link
Contributor Author

Thank you! I'll update our repo to the new version later today

@stefanzweifel
Copy link
Owner

Thank you! I'll update our repo to the new version later today

If you reference just @v4 you get the update automatically btw.

@amonshiz
Copy link
Contributor Author

amonshiz commented Oct 25, 2022

@stefanzweifel I have updated our references to @v4 but am still seeing the set-output warning. Do we need to reference a specific release also?

Run stefanzweifel/git-auto-commit-action@v4
  with:
    commit_message: [Sourcery] Update generated files
    file_pattern: *.swift
    commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    push_options: --dry-run
    branch: amonshiz/amonshiz/prdi-669-fix-swiftlint-output-to-github_output
    repository: .
    commit_user_name: github-actions[bot]
    commit_user_email: github-actions[bot]@users.noreply.github.com
    skip_dirty_check: false
    skip_fetch: false
    skip_checkout: false
    disable_globbing: false
    create_branch: false
  env:
    sourcePackageCache: Stage/SourcePackages
    BUNDLE_OUTPUT_DIRECTORY: xcresult-bundles
    SPM_ARCH: arm64
    GITHUB_TOKEN: 
Started: bash /Users/administrator/actions-runner-work/_actions/stefanzweifel/git-auto-commit-action/v4/entrypoint.sh
INPUT_REPOSITORY value: .
INPUT_STATUS_OPTIONS: 
INPUT_FILE_PATTERN: *.swift
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Working tree clean. Nothing to commit.

@amonshiz
Copy link
Contributor Author

Ah, never mind. I see that you had to set it back to the old format for enterprise users. I’ll update our reference to v4.15.2 to get the changes and silence the warnings for ourselves.

@stefanzweifel
Copy link
Owner

Yeah, my bad for mentioning you can/should reference v4.
I will update the Action in the next couple of days to support both syntaxes. (I really don't want to tag a major version for something silly like this.)

The old syntax is being deprecated by GitHub in June 2023. I will probably remove it – again – by the end of the year, as the majority of Enterprise users will then probably have upgraded their runners.

(Also wanna start a discussion with GitHub, on how to handle such changes in the future better)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning: The set-output command is deprecated and will be disabled soon.
2 participants