Git Product home page Git Product logo

black-action's People

Contributors

abn avatar lgeiger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

black-action's Issues

Provide a complete example?

I'm currently struggling to get this set up over in https://github.com/mlissner/black-tests. It seems like it should be so simple, but getting the github action figured out is really hard, apparently. I'm sort of just batting around in the dark. Making progress, but with much frustration.

Would it be possible to provide an example repository using this action? Or to have it run on this repository?

Thanks for the great tool. I hope I can get it to work!

Please do a release

I just learned that #3 fixes the issue that I've been having trying to get things working today. I got this action from the Github marketplace, and it gave me a copy/paste dialog that used v1.0.1 instead of master. Switching to master fixes things.

Would it make sense to do a release since #3 is fixed? Otherwise the default instructions from the marketplace fail.

Would it be possible to write reformatted code back into the PR?

Use case: I make a modification of a repo's (that I do not own) code and send in a PR. Black-action runs on that PR and instead of failing the run, it replaces the code in my PR with Black formatted code. This would make Black formatting automatic instead of forcing committers to do it manually each time that tests fail.

action "Lint" {
  uses = "lgeiger/black-action@master"
  with:
    repo-token: "${{ secrets.GITHUB_TOKEN }}"
  args = ". --check"
}

https://developer.github.com/actions/managing-workflows/storing-secrets/#github-token-secret

git diff master -U0 | black --diff # would provide a diff for each file
For each Python file that had a diff, we could commit the black changes back into the PR.

Seeing "files would be reformatted" false positive

Hi,
Something weird started happening today: the workflow job

  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Check black formatting
        uses: lgeiger/black-action@master
        with:
          args: '. -l 120 --exclude ".*/node_modules/.*" --check'

is failing over:

would reformat /github/workspace/academic_helper/forms/login_form.py
would reformat /github/workspace/academic_helper/forms/password_reset_form.py
would reformat /github/workspace/academic_helper/forms/signup_form.py
would reformat /github/workspace/academic_helper/logic/schedule.py
would reformat /github/workspace/academic_helper/management/commands/fetch_courses.py
would reformat /github/workspace/academic_helper/management/init_data.py
would reformat /github/workspace/academic_helper/logic/shnaton_parser.py
would reformat /github/workspace/academic_helper/migrations/0002_ratingdummy.py
would reformat /github/workspace/academic_helper/migrations/0001_initial.py
would reformat /github/workspace/academic_helper/migrations/0003_auto_20200527_1531.py
would reformat /github/workspace/academic_helper/migrations/0004_courseclass_courseoccurrence.py
would reformat /github/workspace/academic_helper/migrations/0006_auto_20200531_1534.py
would reformat /github/workspace/academic_helper/migrations/0007_classschedule.py
would reformat /github/workspace/academic_helper/migrations/0008_auto_20200604_0112.py
would reformat /github/workspace/academic_helper/migrations/0005_auto_20200530_2121.py
would reformat /github/workspace/academic_helper/migrations/0009_auto_20200628_0038.py
would reformat /github/workspace/academic_helper/migrations/0011_auto_20200709_1858.py
would reformat /github/workspace/academic_helper/migrations/0012_auto_20200710_1233.py
would reformat /github/workspace/academic_helper/migrations/0013_coursistuser_degree_program.py
would reformat /github/workspace/academic_helper/migrations/0010_auto_20200629_1808.py
would reformat /github/workspace/academic_helper/migrations/0014_auto_20200814_0226.py
would reformat /github/workspace/academic_helper/migrations/0016_auto_20200814_0317.py
would reformat /github/workspace/academic_helper/migrations/0015_auto_20200814_0231.py
would reformat /github/workspace/academic_helper/migrations/0017_auto_20200814_1153.py
would reformat /github/workspace/academic_helper/migrations/0018_coursecomment.py
would reformat /github/workspace/academic_helper/models/course_comment.py
would reformat /github/workspace/academic_helper/models/coursist_user.py
would reformat /github/workspace/academic_helper/tests/test_courses_logic.py
would reformat /github/workspace/academic_helper/urls.py
would reformat /github/workspace/academic_helper/utils/sentry.py
would reformat /github/workspace/academic_helper/views/schedule.py
would reformat /github/workspace/app/settings.py
Oh no! ๐Ÿ’ฅ ๐Ÿ’” ๐Ÿ’ฅ
32 files would be reformatted, 46 files would be left unchanged.

When running black . -l 120 --exclude ".*/node_modules/.*" in the project root dir, I'm getting the expected output:

All done! โœจ ๐Ÿฐ โœจ
78 files left unchanged.

Image build failures due to "regex" package requirement

The latest release of black seems to break the image build.

Failed to build regex
Installing collected packages: regex, typed-ast, pathspec, appdirs, toml, click, attrs, black
    Running setup.py install for regex: started
    Running setup.py install for regex: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o7zo_sju/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o7zo_sju/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vvj9t9bd/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-o7zo_sju/regex/
    Complete output (22 lines):
    BASE_DIR is /tmp/pip-install-o7zo_sju/regex
    /usr/local/lib/python3.8/site-packages/setuptools/dist.py:472: UserWarning: Normalizing '2019.08.19' to '2019.8.19'
      warnings.warn(
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/regex
    copying regex_3/regex/__init__.py -> build/lib.linux-x86_64-3.8/regex
    copying regex_3/regex/regex.py -> build/lib.linux-x86_64-3.8/regex
    copying regex_3/regex/_regex_core.py -> build/lib.linux-x86_64-3.8/regex
    creating build/lib.linux-x86_64-3.8/regex/test
    copying regex_3/regex/test/__init__.py -> build/lib.linux-x86_64-3.8/regex/test
    copying regex_3/regex/test/test_regex.py -> build/lib.linux-x86_64-3.8/regex/test
    running build_ext
    building 'regex._regex' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/regex_3
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c regex_3/_regex.c -o build/temp.linux-x86_64-3.8/regex_3/_regex.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o7zo_sju/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o7zo_sju/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vvj9t9bd/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
The command '/bin/sh -c pip install black' returned a non-zero code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.