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

GitHub Action: Use action version as default Black version, instead of latest #3382

Closed
ichard26 opened this issue Nov 14, 2022 · 1 comment · Fixed by #3543
Closed

GitHub Action: Use action version as default Black version, instead of latest #3382

ichard26 opened this issue Nov 14, 2022 · 1 comment · Fixed by #3543
Assignees
Labels
C: integrations Editor plugins and other integrations T: enhancement New feature or request

Comments

@ichard26
Copy link
Collaborator

I'm alright with making the default Black version tied to the action version being used. For context version was introduced because the action didn't exist for a long time so tying black version to action version wouldn't work for version 19.10b0 for example. In hidesight, having the default being the action version keeping the version configuration option around as an escape hatch is the better solution. This will involve some complexity since commit SHAs aren't supported by the version code (but are by GHA) but there might be some pre-existing logic in scripts/diff_shades_gha_helper.py we could reuse.

Originally posted by @ichard26 in #1140 (comment)

@ichard26 ichard26 changed the title GitHub Aciton: Use action version as default Black version, instead of latest GitHub Action: Use action version as default Black version, instead of latest Nov 14, 2022
@ichard26 ichard26 added T: enhancement New feature or request C: integrations Editor plugins and other integrations labels Nov 14, 2022
@ichard26 ichard26 self-assigned this Nov 14, 2022
@ricardo-dematos
Copy link

ricardo-dematos commented Nov 23, 2022

Currently, when dependabot highlights the black-github-action need to be updated and we choose to ignore that update, because we want to stick with that version, the code will be checked/formatted with the new release!

Here's an example:

      - name: 'Check code with black'
        id: black
        uses: psf/[email protected]
        with:
          options: '--target-version py39 --line-length 120 --diff --check'

Even being aware of the documentation, thus defining the desired version, may lead to an unintended configuration:

      - name: 'Check code with black'
        id: black
        uses: psf/[email protected] # <-- dependabot update!
        with:
          options: '--target-version py39 --line-length 120 --diff --check'
          version: '22.8.0'

So, definitely I'm in favour of tying the Black version with the action version. 😃


On the web site one can read:

The version of Black the action will use can be configured via version. This can be any valid version specifier or just the version number if you want an exact version. The action defaults to the latest release available on PyPI. Only versions available from PyPI are supported, so no commit SHAs or branch names.

On the action YML one can read:

  version:
    description: 'Python Version specifier (PEP440) - e.g. "21.5b1"'
    required: false
    default: ""

Notice that the field description gives the idea that it's purpose is to set the python version, or maybe the --target-version, but the documentation clearly states it's intended to define the Black version to use. 😕

ankenyr added a commit to aerleon/aerleon that referenced this issue Feb 3, 2023
The `psf/[email protected]` was actually the github action version rather than the version of black. This is talked about in 
psf/black#3382

We are not pinning the version of black and using stable for the github action version.
jtwb pushed a commit to aerleon/aerleon that referenced this issue Feb 4, 2023
The `psf/[email protected]` was actually the github action version rather than the version of black. This is talked about in 
psf/black#3382

We are not pinning the version of black and using stable for the github action version.
raffermeko added a commit to raffermeko/aerleon that referenced this issue Aug 12, 2024
The `psf/[email protected]` was actually the github action version rather than the version of black. This is talked about in 
psf/black#3382

We are not pinning the version of black and using stable for the github action version.
ngiyakhey2 added a commit to ngiyakhey2/aerleon that referenced this issue Aug 14, 2024
The `psf/[email protected]` was actually the github action version rather than the version of black. This is talked about in 
psf/black#3382

We are not pinning the version of black and using stable for the github action version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: integrations Editor plugins and other integrations T: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants