Giter VIP home page Giter VIP logo

action's Introduction

this action is in maintenance-only mode and will not be accepting new features.

generally you want to use pre-commit.ci which is faster and has more features.


pre-commit.ci status Build Status

pre-commit/action

a GitHub action to run pre-commit

using this action

To use this action, make a file .github/workflows/pre-commit.yml. Here's a template to get started:

name: pre-commit

on:
  pull_request:
  push:
    branches: [main]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v3
    - uses: pre-commit/[email protected]

This does a few things:

  • clones the code
  • installs python
  • sets up the pre-commit cache

using this action with custom invocations

By default, this action runs all the hooks against all the files. extra_args lets users specify a single hook id and/or options to pass to pre-commit run.

Here's a sample step configuration that only runs the flake8 hook against all the files (use the template above except for the pre-commit action):

    - uses: pre-commit/[email protected]
      with:
        extra_args: flake8 --all-files

using this action in private repositories

prior to v3.0.0, this action had custom behaviour which pushed changes back to the pull request when supplied with a token.

this behaviour was removed:

  • it required a PAT (didn't work with short-lived GITHUB_TOKEN)
  • properly hiding this input from the installation and execution of hooks is intractable in github actions (it is readily available as $INPUT_TOKEN)
  • this meant potentially unvetted code could access the token via the environment

you can likely achieve the same thing with an external action such as git-auto-commit-action though you may want to take precautions to clear git hooks or other ways that arbitrary code execution can occur when running git commit / git push (for example core.fsmonitor).

while unrelated to this action, pre-commit.ci avoids these problems by installing and executing isolated from the short-lived repository-scoped installation access token.

action's People

Contributors

ad-m avatar asottile avatar deepyaman avatar dependabot[bot] avatar evanstoddard23 avatar henryh9n avatar jackton1 avatar julian avatar pradyunsg avatar pre-commit-ci[bot] avatar s-weigand avatar sukicz avatar trim21 avatar uranusjr 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

action's Issues

use with private hook

I'm trying to use this with a private custom hook, our .pre-commint-config.yaml looks something like

repos:
  - repo: [email protected]:somehwere_private.git

In the action I've got:

      - uses: pre-commit/[email protected]
        with:
          extra_args: --files ${{ steps.file_changes.outputs.files }}
          token: ${{ secrets.GITHUB_TOKEN }}

But I get

An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    [email protected]: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.

Changing config to use HTTP:

repos:
  - repo: https://github.com/somewhere_private.git

results in

An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: could not read Username for 'https://github.com': No such device or address

Action in monorepos

I'm trying to get this action to work in a monorepo with some local hooks. I have this config:

image

pre-commit run -a works locally using WSL Ubuntu 18.04.

The action fails with this error:

image

Any ideas on what I could be doing wrong with the shell parameter expansion?

[feature request] Support different file for action

The action does not seem to support setting --config to a different file if the default one does not exist; I get the following error:

ENOENT: no such file or directory, open '.pre-commit-config.yaml'

Possibly because of this?

const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`;

Possible suggestion: add a config input to the action, which would fill in this spot too.

PS: I'm currently trying to do some fairly crazy things trying to test a cookiecutter project, and this is something I ran into there. I can probably run pre-commit manually and lose the caching for now. Actually, I can just copy this to the normal place before running, I'm doing crazy things to the directory anyway.

Push of changes is not initiated in private repo

Hi,

sorry if this is a dumb question but it's my first time using this.

When pushing to my repo Github correctly launches the action and all pre-commits are executed but somehow the action does not initiate updating the reformatted code.

Did I do something incorrectly?

Thanks!

My logs:

2020-10-16T20:01:09.2710272Z [INFO]�[m Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
2020-10-16T20:01:11.1861760Z [INFO]�[m Initializing environment for https://github.com/psf/black.
2020-10-16T20:01:13.4022321Z [INFO]�[m Initializing environment for https://github.com/pre-commit/pygrep-hooks.
2020-10-16T20:01:15.0005280Z [INFO]�[m Installing environment for https://github.com/pre-commit/pre-commit-hooks.
2020-10-16T20:01:15.0008023Z [INFO]�[m Once installed this environment will be reused.
2020-10-16T20:01:15.0009037Z [INFO]�[m This may take a few minutes...
2020-10-16T20:01:20.1172922Z [INFO]�[m Installing environment for https://github.com/psf/black.
2020-10-16T20:01:20.1174282Z [INFO]�[m Once installed this environment will be reused.
2020-10-16T20:01:20.1175121Z [INFO]�[m This may take a few minutes...
2020-10-16T20:01:25.8650165Z Trim Trailing Whitespace.................................................�[41mFailed�[m
2020-10-16T20:01:25.8651942Z �[2m- hook id: trailing-whitespace�[m
2020-10-16T20:01:25.8653934Z �[2m- exit code: 1�[m
2020-10-16T20:01:25.8654785Z �[2m- files were modified by this hook�[m
2020-10-16T20:01:25.8655396Z 
2020-10-16T20:01:25.8660598Z Fixing .github/workflows/pre-commit.yml
2020-10-16T20:01:25.8662038Z Fixing .github/workflows/python-app.yml
2020-10-16T20:01:25.8662676Z 
2020-10-16T20:01:25.9203828Z Fix End of Files.........................................................�[42mPassed�[m
2020-10-16T20:01:25.9993984Z Check Yaml...............................................................�[42mPassed�[m
2020-10-16T20:01:27.5013246Z Check for added large files..............................................�[42mPassed�[m
2020-10-16T20:01:27.5600189Z Check python ast.........................................................�[42mPassed�[m
2020-10-16T20:01:27.6200483Z Check docstring is first.................................................�[42mPassed�[m
2020-10-16T20:01:27.6206421Z Pretty format JSON...................................(no files to check)�[46;30mSkipped�[m
2020-10-16T20:01:27.6761837Z Detect AWS Credentials...................................................�[42mPassed�[m
2020-10-16T20:01:27.6763835Z Fix requirements.txt.................................(no files to check)�[46;30mSkipped�[m
2020-10-16T20:01:27.7409356Z Fix double quoted strings................................................�[41mFailed�[m
2020-10-16T20:01:27.7410813Z �[2m- hook id: double-quote-string-fixer�[m
2020-10-16T20:01:27.7413264Z �[2m- exit code: 1�[m
2020-10-16T20:01:27.7414152Z �[2m- files were modified by this hook�[m
2020-10-16T20:01:27.7414640Z 
2020-10-16T20:01:27.7420673Z Fixing strings in get_new_ln.py
2020-10-16T20:01:27.7421173Z 
2020-10-16T20:01:28.7706134Z black....................................................................�[41mFailed�[m
2020-10-16T20:01:28.7707414Z �[2m- hook id: black�[m
2020-10-16T20:01:28.7708205Z �[2m- files were modified by this hook�[m
2020-10-16T20:01:28.7708690Z 
2020-10-16T20:01:28.7716635Z �[1mreformatted get_new_ln.py�[0m
2020-10-16T20:01:28.7717486Z �[1mAll done! ✨ 🍰 ✨�[0m
2020-10-16T20:01:28.7718204Z �[1m1 file reformatted�[0m.�[0m
2020-10-16T20:01:28.7718698Z 
2020-10-16T20:01:28.8882797Z type annotations not comments............................................�[42mPassed�[m
2020-10-16T20:01:28.8884237Z pre-commit hook(s) made changes.
2020-10-16T20:01:28.8885361Z If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
2020-10-16T20:01:28.8886573Z To run `pre-commit` as part of git workflow, use `pre-commit install`.
2020-10-16T20:01:28.8887295Z All changes made by hooks:
2020-10-16T20:01:28.8919383Z �[1mdiff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml�[m
2020-10-16T20:01:28.8920464Z �[1mindex c0a5308..1263a68 100644�[m
2020-10-16T20:01:28.8921236Z �[1m--- a/.github/workflows/pre-commit.yml�[m
2020-10-16T20:01:28.8922077Z �[1m+++ b/.github/workflows/pre-commit.yml�[m
2020-10-16T20:01:28.8922753Z �[36m@@ -11,7 +11,7 @@�[m �[mjobs:�[m
2020-10-16T20:01:28.8923294Z        with:�[m
2020-10-16T20:01:28.8923887Z          fetch-depth: 0�[m
2020-10-16T20:01:28.8924558Z      - uses: actions/setup-python@v2�[m
2020-10-16T20:01:28.8925171Z �[31m-      with: �[m
2020-10-16T20:01:28.8925739Z �[32m+�[m�[32m      with:�[m
2020-10-16T20:01:28.8926356Z          python-version: '3.8'�[m
2020-10-16T20:01:28.8927038Z      - uses: pre-commit/[email protected]�[m
2020-10-16T20:01:28.8927998Z        with:�[m
2020-10-16T20:01:28.8929154Z �[1mdiff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml�[m
2020-10-16T20:01:28.8930139Z �[1mindex bb0c645..8cc3289 100644�[m
2020-10-16T20:01:28.8932131Z �[1m--- a/.github/workflows/python-app.yml�[m
2020-10-16T20:01:28.8932963Z �[1m+++ b/.github/workflows/python-app.yml�[m
2020-10-16T20:01:28.8933747Z �[36m@@ -5,7 +5,7 @@�[m �[mname: Python application�[m
2020-10-16T20:01:28.8934331Z  �[m
2020-10-16T20:01:28.8934809Z  on:�[m
2020-10-16T20:01:28.8935301Z    push:�[m
2020-10-16T20:01:28.8935849Z �[31m-    branches: �[m
2020-10-16T20:01:28.8936440Z �[32m+�[m�[32m    branches:�[m
2020-10-16T20:01:28.8937005Z        - stable�[m
2020-10-16T20:01:28.8937541Z    pull_request:�[m
2020-10-16T20:01:28.8938099Z      branches:�[m
2020-10-16T20:01:28.8938753Z �[1mdiff --git a/get_new_ln.py b/get_new_ln.py�[m
2020-10-16T20:01:28.8939444Z �[1mindex bbbe673..2d4ca81 100755�[m
2020-10-16T20:01:28.8940076Z �[1m--- a/get_new_ln.py�[m
2020-10-16T20:01:28.8940667Z �[1m+++ b/get_new_ln.py�[m
2020-10-16T20:01:28.8941309Z �[36m@@ -10,8 +10,8 @@�[m �[mimport math�[m
2020-10-16T20:01:28.8942012Z  from botocore.client import Config�[m
2020-10-16T20:01:28.8942632Z  �[m
2020-10-16T20:01:28.8943160Z  config = Config(�[m
2020-10-16T20:01:28.8943899Z �[31m-    connect_timeout=5, retries={"total_max_attempts": 2,�[m
2020-10-16T20:01:28.8944634Z �[31m-                                "mode": "standard"})�[m
2020-10-16T20:01:28.8954524Z �[32m+�[m�[32m    connect_timeout=5, retries={"total_max_attempts": 2, "mode": "standard"}�[m
2020-10-16T20:01:28.8955497Z �[32m+�[m�[32m)�[m
2020-10-16T20:01:28.8956015Z  �[m
2020-10-16T20:01:28.8956690Z  S3_CLIENT = boto3.client("s3", config=config)�[m
2020-10-16T20:01:28.8957506Z  SNF_CLIENT = boto3.client("stepfunctions")�[m
2020-10-16T20:01:28.9122562Z ##[error]The process '/opt/hostedtoolcache/Python/3.8.6/x64/bin/pre-commit' failed with exit code 1

Differently formatted:

Run pre-commit/[email protected]
2
  with:
3
    token: ***
4
    extra_args: --all-files
5
  env:
6
    pythonLocation: /opt/hostedtoolcache/Python/3.8.6/x64
7
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.6/x64/lib
8
install pre-commit
9
  /opt/hostedtoolcache/Python/3.8.6/x64/bin/pip install pre-commit
10
  Collecting pre-commit
11
    Downloading pre_commit-2.7.1-py2.py3-none-any.whl (171 kB)
12
  Collecting pyyaml>=5.1
13
    Downloading PyYAML-5.3.1.tar.gz (269 kB)
14
  Collecting cfgv>=2.0.0
15
    Downloading cfgv-3.2.0-py2.py3-none-any.whl (7.3 kB)
16
  Collecting toml
17
    Downloading toml-0.10.1-py2.py3-none-any.whl (19 kB)
18
  Collecting identify>=1.0.0
19
    Downloading identify-1.5.6-py2.py3-none-any.whl (97 kB)
20
  Collecting virtualenv>=20.0.8
21
    Downloading virtualenv-20.0.35-py2.py3-none-any.whl (4.9 MB)
22
  Collecting nodeenv>=0.11.1
23
    Downloading nodeenv-1.5.0-py2.py3-none-any.whl (21 kB)
24
  Collecting appdirs<2,>=1.4.3
25
    Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
26
  Collecting distlib<1,>=0.3.1
27
    Downloading distlib-0.3.1-py2.py3-none-any.whl (335 kB)
28
  Collecting six<2,>=1.9.0
29
    Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
30
  Collecting filelock<4,>=3.0.0
31
    Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
32
  Using legacy 'setup.py install' for pyyaml, since package 'wheel' is not installed.
33
  Installing collected packages: pyyaml, cfgv, toml, identify, appdirs, distlib, six, filelock, virtualenv, nodeenv, pre-commit
34
      Running setup.py install for pyyaml: started
35
      Running setup.py install for pyyaml: finished with status 'done'
36
  Successfully installed appdirs-1.4.4 cfgv-3.2.0 distlib-0.3.1 filelock-3.0.12 identify-1.5.6 nodeenv-1.5.0 pre-commit-2.7.1 pyyaml-5.3.1 six-1.15.0 toml-0.10.1 virtualenv-20.0.35
37
  /opt/hostedtoolcache/Python/3.8.6/x64/bin/pip freeze --local
38
  appdirs==1.4.4
39
  cfgv==3.2.0
40
  distlib==0.3.1
41
  filelock==3.0.12
42
  identify==1.5.6
43
  nodeenv==1.5.0
44
  pre-commit==2.7.1
45
  PyYAML==5.3.1
46
  six==1.15.0
47
  toml==0.10.1
48
  virtualenv==20.0.35
49
/opt/hostedtoolcache/Python/3.8.6/x64/bin/pre-commit run --show-diff-on-failure --color=always --all-files
50
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
51
[INFO] Initializing environment for https://github.com/psf/black.
52
[INFO] Initializing environment for https://github.com/pre-commit/pygrep-hooks.
53
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
54
[INFO] Once installed this environment will be reused.
55
[INFO] This may take a few minutes...
56
[INFO] Installing environment for https://github.com/psf/black.
57
[INFO] Once installed this environment will be reused.
58
[INFO] This may take a few minutes...
59
Trim Trailing Whitespace.................................................Failed
60
- hook id: trailing-whitespace
61
- exit code: 1
62
- files were modified by this hook
63

64
Fixing .github/workflows/pre-commit.yml
65
Fixing .github/workflows/python-app.yml
66

67
Fix End of Files.........................................................Passed
68
Check Yaml...............................................................Passed
69
Check for added large files..............................................Passed
70
Check python ast.........................................................Passed
71
Check docstring is first.................................................Passed
72
Pretty format JSON...................................(no files to check)Skipped
73
Detect AWS Credentials...................................................Passed
74
Fix requirements.txt.................................(no files to check)Skipped
75
Fix double quoted strings................................................Failed
76
- hook id: double-quote-string-fixer
77
- exit code: 1
78
- files were modified by this hook
79

80
Fixing strings in get_new_ln.py
81

82
black....................................................................Failed
83
- hook id: black
84
- files were modified by this hook
85

86
reformatted get_new_ln.py
87
All done! ✨ 🍰 ✨
88
1 file reformatted.
89

90
type annotations not comments............................................Passed
91
pre-commit hook(s) made changes.
92
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
93
To run `pre-commit` as part of git workflow, use `pre-commit install`.
94
All changes made by hooks:
95
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
96
index c0a5308..1263a68 100644
97
--- a/.github/workflows/pre-commit.yml
98
+++ b/.github/workflows/pre-commit.yml
99
@@ -11,7 +11,7 @@ jobs:
100
       with:
101
         fetch-depth: 0
102
     - uses: actions/setup-python@v2
103
-      with: 
104
+      with:
105
         python-version: '3.8'
106
     - uses: pre-commit/[email protected]
107
       with:
108
diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml
109
index bb0c645..8cc3289 100644
110
--- a/.github/workflows/python-app.yml
111
+++ b/.github/workflows/python-app.yml
112
@@ -5,7 +5,7 @@ name: Python application
113
 
114
 on:
115
   push:
116
-    branches: 
117
+    branches:
118
       - stable
119
   pull_request:
120
     branches:
121
diff --git a/get_new_ln.py b/get_new_ln.py
122
index bbbe673..2d4ca81 100755
123
--- a/get_new_ln.py
124
+++ b/get_new_ln.py
125
@@ -10,8 +10,8 @@ import math
126
 from botocore.client import Config
127
 
128
 config = Config(
129
-    connect_timeout=5, retries={"total_max_attempts": 2,
130
-                                "mode": "standard"})
131
+    connect_timeout=5, retries={"total_max_attempts": 2, "mode": "standard"}
132
+)
133
 
134
 S3_CLIENT = boto3.client("s3", config=config)
135
 SNF_CLIENT = boto3.client("stepfunctions")
136
Error: The process '/opt/hostedtoolcache/Python/3.8.6/x64/bin/pre-commit' failed with exit code 1

My .pre-commit-config.yaml file

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files
    -   id: check-ast
    -   id: check-docstring-first
    -   id: pretty-format-json
        args: ['--autofix --no-sort-keys']
    -   id: detect-aws-credentials
        args: ['--allow-missing-credentials']
    -   id: requirements-txt-fixer
    -   id: double-quote-string-fixer
-   repo: https://github.com/psf/black
    rev: 20.8b1
    hooks:
    -   id: black
        language_version: python3 # Should be a command that runs python3.6+
-   repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.6.0
    hooks:
    -   id: python-use-type-annotations

My pre-commit.yml file

name: pre-commit

on:
  push:

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: actions/setup-python@v2
      with: 
        python-version: '3.8'
    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

Not pushing back fixes on private repo

Hi folks,

First of all, thank you very much for the pre-commit! I really like to use it :)

The problem I am facing is that, I have a self-hosted machine for my private repository, it runs normally and it will accuse the problems, but it is not fixing the errors as it is mentioned on the docs. Maybe I am missing something, sorry if it is the case.

That is my yaml for pre-commit:

name: pre-commit

on:
  pull_request:
  push:
    branches: [master]

jobs:
  pre-commit:
    runs-on: [self-hosted, linux, x64]
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: actions/setup-python@v2
    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

and my .pre-commit-config.yaml is:

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: fix-encoding-pragma
        args: [--remove]
    -   id: sort-simple-yaml
    -   id: check-toml
    -   id: check-json
    -   id: check-merge-conflict
    -   id: pretty-format-json
        args: [--autofix]
    -   id: debug-statements
        language_version: python3
-   repo: https://github.com/pre-commit/mirrors-isort
    rev: v5.2.2
    hooks:
        -   id: isort
-   repo: https://gitlab.com/pycqa/flake8
    rev: 3.8.3
    hooks:
    -   id: flake8
        exclude: tests/data
        language_version: python3
        additional_dependencies:
            - flake8-typing-imports==1.9.0
            - flake8-builtins==1.5.3
            - flake8-bugbear==20.1.4
            - flake8-isort==3.0.1

Do you need any more information?

hooks with entry fail in action

I need to run language: system on the mypy hook in order to get it working with my project (related: pre-commit/pre-commit#945).

As a result, Github action fails to run mypy on checks.

.pre-commit-config.yaml

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.770
    hooks:
      - id: mypy
        additional_dependencies: ["mypy==0.770", ...]
        language: system
        entry: env PYTHONPATH=$PYTHONPATH:app mypy
        files: \.py$
        args:
          [
            --config-file=app/mypy.ini
          ]

workflows/mypy.yml

name: mypy

on:
  pull_request:
  push:
    branches: [master]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-python@v1
    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        extra_args: mypy --all-files

Result:

mypy.....................................................................Failed
- hook id: mypy
- exit code: 127

/usr/bin/env: ‘mypy’: No such file or directory

Do you have a suggestion to fix this issue? Or is it just not possible to run mypy on github actions using pre-commit/action in my situation?

Action versioning not following GitHub recommendations

GitHub Actions has recommendations on how to handle releases via tagging:

  • Create a release using semantic versioning. For more information, see "Creating releases."
  • Move the major version tag (such as v1, v2) to point to the Git ref of the current release. [...]

It would be great if this repository adapts the suggested recommendations 🙂.

That way every user could simply do

uses: pre-commit/action@v2

in their GitHub action and will always get the latest 2.X.Y version.

While I saw your comments, that you do not expect big/major changes, I think many users might be/are used to referencing actions by the major version (only) for their other roles (since it's the "official" recommendation).

Safe to run on private repos?

This StackOverflow answer seems to indicate that this is safe on public repos, including PRs.

The README states that:

while you could technically configure this for a public repository (using a personal access token), I can't think of a way to do this safely without exposing a privileged token to pull requests -- if you have any ideas, please leave an issue!

I'm not sure why a PAT is required. If you use GITHUB_TOKEN, then this won't expose a privileged token to PRs.

Action fails if saving cache fails

First of all thanks for this action 😄

Today I had my pre-commit job failing, with the following error, which isn't fixable by rerunning the job:

Error: reserveCache failed: Cache already exists. Scope: refs/pull/80/merge, Key: pre-commit-2-b76e203571a33b83fd824866e8e8daaeda30555cba9e70eb155d9e5310e578b8-7365e065f5f4ed7e591c7e54ee4f8c40d559f8ff4d40fb8fc9eec5d1a9d2e11c, Version: 28cdb9f5496f334116f23e86f0063f5d3a9348c2e22425a33171e071aadada7e

My best guess is, that this caused by a corrupted cache, where a cache entry with the key exists, but cache.restoreCache is unable to restore it properly (maybe on: push and on: pull_request wanted to save the cache at the same time? 😵 ).
So this might be a very rare and quite impossible to reproduce case.

Anyway, since the cache is nice and all, but not a key feature, IMHO it would be reasonable to catch errors caused by cache.saveCache and give users a warning ( core.warning), instead of letting it bubble up to core.setFailed.

main().catch((e) => core.setFailed(e.message));

Also, there have been some changes to @actions/cache since version 0.2.1 which you use, so running npm upgrade might improve this action as well.

hook has different output when run in action

I am having trouble getting a pre-commit hook to give the same output locally and when run through this action.

In particular, isort seems to treat imports of the local package in tests and examples differently.
Here is an example https://github.com/musoke/LearnAsYouGoEmulator/pull/1/checks?check_run_id=489363948 https://github.com/musoke/LearnAsYouGoEmulator/pull/2/checks?check_run_id=489372073

I am quite sure that this is not because of differences in my local isort configuration.

Cache problem with Node.js

Hi everybody,

I noticed a problem with pre-commit action's cache and using Node.js environment. I'm using eslint in pre-commit and to make eslint-plugin-import work properly I need to install the dependencies. So, my workflow looks the following:

jobs:
  pre-commit:
    name: Pre-commit hooks
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: '3.8'
    - name: Use Node.js 14
      uses: actions/setup-node@v2-beta
      with:
        node-version: '14'
    - name: Cache Node.js modules
      uses: actions/cache@v2
      with:
        path: ~/.npm
        key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.OS }}-node-
          ${{ runner.OS }}-
    - name: Install frontend dependencies
      run: npm install
      working-directory: frontend
    - name: Run pre-commit hooks
      uses: pre-commit/[email protected]

The problem is that because I only use node-version: '14' in the setup-node phase the Node.js version will change after a while to a newer version but the pre-commit action's cache does not care for that and tries to use a cached version where a previous version of Node.js was used and the following error occurs:

eslint...................................................................Failed
- hook id: eslint
- exit code: 127

/home/runner/.cache/pre-commit/repoibq27hfw/node_env-system/bin/node: line 5: /opt/hostedtoolcache/node/14.8.0/x64/bin/node: No such file or directory
/home/runner/.cache/pre-commit/repoibq27hfw/node_env-system/bin/node: line 5: /opt/hostedtoolcache/node/14.8.0/x64/bin/node: No such file or directory

##[error]The process '/opt/hostedtoolcache/Python/3.8.5/x64/bin/pre-commit' failed with exit code 1

and I can see that the setup-node used version 14.9.0.

Run actions/setup-node@v2-beta
version: 14
Found in cache @ /opt/hostedtoolcache/node/14.9.0/x64

I used a "workaround" a specified a fully qualified node-version but I don't think this is the best solution. Is there any way to either disable the cache or make it sensitive for the Node.js version?

Thanks!

`python --version --version`?

Hi there,

Thanks for posting this repo---it is very helpful. :) I had a question about this line from the README.md:

run: echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' ' -f1)"

I'm having trouble understanding this---should that be just python --version? Also, python --version outputs to stderr, not stdout, so I think sha256sum is just receiving an empty string.

I'm not sure what the motivation to set env.PY is (I guess maybe to check that the Python version hasn't changed?), so I'm hesitant to try and find a fix myself, and I thought the better thing to do might be to ask. :)

Thank you! 👍

Pre-commit hooks called twice

When configured with a GitHub token, the action will push back fixes to the pull request branch. However, in doing so, it runs the pre-commit hooks twice. Can we get this to run them only once?

action/index.js

Lines 55 to 64 in ec497e5

const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
if (!restored) {
await cache.saveCache(cachePaths, cacheKey);
}
if (ret && push) {
// actions do not run on pushes made by actions.
// need to make absolute sure things are good before pushing
// TODO: is there a better way around this limitation?
await exec.exec('pre-commit', args);

Also, can we make this a GitHub status check, so we can wait for it to finish/succeed before starting a CI build?

In v2.0.1 the released content does not include 'dist/index.js' file

Compare two latest releases:

$ wget https://github.com/pre-commit/action/archive/refs/tags/v2.0.1.tar.gz
$ tar -xvzf v2.0.1.tar.gz
$ wget https://github.com/pre-commit/action/archive/refs/tags/v2.0.0.tar.gz
$ tar -xvzf v2.0.0.tar.gz
$ rm v2.0.1.tar.gz v2.0.0.tar.gz
$ ls action-2.0.0
action.yml  dist  LICENSE  README.md
$ ls action-2.0.1
action.yml  index.js  LICENSE  Makefile  package.json  package-lock.json  README.md  webpack.config.js
$ rm -r action-2.0.0 action-2.0.1

That causes a file not found error running the action with latest release. It seems to me a problem with the released branch, being this master instead of release.

Plan for repo?

Is there a plan to add an example or a GitHub Action? (this is very intriguing)

File Not Found Error with v1.1.1

Hello! I came across this action for running pre-commit with Github actions and found it very useful. However, there seems to be a bug with the 1.1.1 version of this action. When I use this version in my workflow, I get this error:

File not found: '/home/runner/work/_actions/pre-commit/action/v1.1.1/dist/index.js'

I believe this is because the action.yml file is still pointing to dist/index.js file for the action entrypoint, when the 1.1.1 doesn't have code packaged in a dist directory.

Note that v1.1.0 seems to work just fine.

Custom repository path support

It may be needed when custom path for checkout is used. In my case I do it because I need to checkout another repo with CI tools:

      - name: Checkout Repo
        uses: actions/checkout@v2
        with:
          path: REPO
      - name: Checkout TOOLS
        uses: actions/checkout@v2
        with:
          path: TOOLS
          repository: owner/repo
          ref: master

So, I'd need to set path on using the action:

      - uses: pre-commit/[email protected]
        with:
            path: REPO

Python version problem

Hi,

Good work, thanks for putting this together as well as pre-commit!

I started using this action and ran into a problem related to a python version. In the readme the following configuration is proposed:

name: pre-commit

on:
  pull_request:
  push:
    branches: [master]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - uses: pre-commit/[email protected]

This caused some error for me related to that python 3.7 wasn't available. The following configuration fixed it:

name: pre-commit

on:
  pull_request:
  push:
    branches: [master]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
       with:
        python-version: 3.7
    - uses: pre-commit/[email protected]

The only problem with it is that now it runs on python 3.7

Question About Automatic PRs for Public Repositories

I'm working on setting up a GitHub Actions build for a public repository (see WIP at quantopian/pgcontents#73), and I've set up a step that runs pre-commit using this action. The core functionality seems to be working great!

In the README, I noticed that, for private repositories, this action will automatically create PRs that fix auto-fixable issues when possible. That seems it'd be a great workflow, and I'd love to be able to enable it for my repository, so I'm trying to better understand why it's not currently supported for public repositories.

My current understanding of the security model for actions, derived mostly from this page is as follows:

For any repo with GitHub Actions enabled, GitHub automatically generates a GITHUB_TOKEN for each new action build, with a 60 minute expiration. That token is supplied to any actions' execution, and it grants any new pull request opened in the repository itself the ability to perform a variety of write operations on the repository. Any pull request opened from a fork, however, gets a read-only version of the token, which prevents people from being able to make modifications by opening PRs that modify the actions yaml file.

If the above is correct, then I assume you don't enable automatic PRs for public repositories because the majority of pull requests against public repos will come from forks, rather than from within the repo itself, in which case the token available to the action won't have permission to create new PRs, in either the parent repository or the originating repository. Is that correct?

`pre-commit/action` does not support the `--config` flag

pre-commit/action assumes the config file is at .pre-commit-config.yaml for caching. A possible fix is to check for the argument of the -c and --config flags in the combined args array. A diff of proposed changes to master is given below...

diff --git a/index.js b/index.js
index 4fc00db..073dd51 100644
--- a/index.js
+++ b/index.js
@@ -48,9 +48,16 @@ async function main() {
     const pr = github.context.payload.pull_request;
     const push = !!token && !!pr;
 
+    // Get config file location from last config argument for caching
+    var configPath = '.pre-commit-config.yaml'  // Default location
+    const cIndex = Math.max(args.lastIndexOf('-c'), args.lastIndexOf('--config'));
+    if (cIndex > -1 && cIndex + 1 < args.length) {
+        configPath = args[cIndex + 1];
+    }
+
     const cachePaths = [path.join(os.homedir(), '.cache', 'pre-commit')];
     const py = getPythonVersion();
-    const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`;
+    const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile(configPath)}`;
     const restored = await cache.restoreCache(cachePaths, cacheKey);
     const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
     if (!restored) {

I am submitting this here since non-collaborator pull requests and issues seem to be disabled for pre-commit/action

error on using cache: No module named 'setuptools'

Logs

https://github.com/it-projects-llc/pos-addons/pull/1200/checks?check_run_id=438932879


isort except __init__.py.................................................Failed
- hook id: isort
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repoov996k65/py_env-python3/bin/isort", line 5, in <module>
    from isort.main import main
  File "/home/runner/.cache/pre-commit/repoov996k65/py_env-python3/lib/python3.7/site-packages/isort/main.py", line 29, in <module>
    import setuptools
ModuleNotFoundError: No module named 'setuptools'
Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repoov996k65/py_env-python3/bin/isort", line 5, in <module>
    from isort.main import main
  File "/home/runner/.cache/pre-commit/repoov996k65/py_env-python3/lib/python3.7/site-packages/isort/main.py", line 29, in <module>
    import setuptools
ModuleNotFoundError: No module named 'setuptools'

Possible Solution

Add extra step to install setuptools?

jobs:
  pre-commit:
    name: "pre-commit"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
      - uses: actions/setup-python@v1
        with:
          python-version: "3.7.x"
      - uses: Install not cached dependencies
        run: |
          pip install setuptools
      - name: Check Python Version
        run:
          echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' '
          -f1)"
      - uses: actions/cache@v1
        with:
          path: ~/.cache/pre-commit
          key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
      - uses: pre-commit/[email protected]

I didn't test it yet

CI failure: The `rev` field appears to be a mutable reference

I am getting the following CI error for the past couple of days, on the pre-commit Github action:

[WARNING] The 'rev' field of repo 'https://github.com/psf/black' appears to be a mutable reference
 (moving tag / branch).  Mutable references are never updated after first install and are not supported.  
See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  
Hint: `pre-commit autoupdate` often fixes this.

Has anyone else got this error lately?

Missing license?

Hello, it looks like this repository and its content don't have any license attached right now — I guess this is an oversight.

In particular it would be nice to have a license of any kind attached to the example configuration, because it seems complex enough that it is copyrightable (I would suggest Unlicense if you just want people to use it without wondering what to do about its license).

Thanks!

Cache exists error

I love the new v2 action, but I got an odd error when converting a repo to use it:

##[error]reserveCache failed: Cache already exists. Scope: refs/pull/20/merge, Key: pre-commit-2-4774c6dcfb04097f665845795b3fc1fdb61ba523c1c117b1fb248ece52e94408-425ac6cd4cf92651d871380a6d2765229c71084a12c70a488fe9357fa3e198a2, Version: 28cdb9f5496f334116f23e86f0063f5d3a9348c2e22425a33171e071aadada7

The only think I've done differently (that I know of) is I enabled the token, just to see the guidelines in the pre-commit/action readme which say it only works on a private repository really means it only works on PRs from the same repository (which, while not as useful as working on PRs from forks, still would be useful in some cases).

https://github.com/scikit-hep/hepunits/pull/20/checks?check_run_id=950105310

caching doesn't seem to work

I'm not sure what I'm doing wrong, but pre-commit/[email protected] doesn't seem to be caching the install of pre-commit hooks. From a recent run:

2020-08-16T06:43:35.0926322Z ##[group]Run pre-commit/[email protected]
2020-08-16T06:43:35.0926495Z with:
2020-08-16T06:43:35.0926645Z   extra_args: --all-files --hook-stage push
2020-08-16T06:43:35.0926892Z env:
2020-08-16T06:43:35.0927037Z   pythonLocation: /opt/hostedtoolcache/Python/3.7.8/x64
2020-08-16T06:43:35.0927183Z ##[endgroup]
2020-08-16T06:43:35.1519152Z ##[group]install pre-commit
2020-08-16T06:43:35.1551835Z [command]/opt/hostedtoolcache/Python/3.7.8/x64/bin/pip install pre-commit
2020-08-16T06:43:35.9035965Z Collecting pre-commit
2020-08-16T06:43:35.9667411Z   Downloading pre_commit-2.6.0-py2.py3-none-any.whl (171 kB)
2020-08-16T06:43:36.0762290Z Collecting pyyaml>=5.1
2020-08-16T06:43:36.0931775Z   Downloading PyYAML-5.3.1.tar.gz (269 kB)
2020-08-16T06:43:36.7270346Z Collecting nodeenv>=0.11.1
2020-08-16T06:43:36.7423211Z   Downloading nodeenv-1.4.0-py2.py3-none-any.whl (21 kB)
2020-08-16T06:43:36.7766490Z Collecting cfgv>=2.0.0
2020-08-16T06:43:36.7911262Z   Downloading cfgv-3.2.0-py2.py3-none-any.whl (7.3 kB)
2020-08-16T06:43:36.9075949Z Collecting identify>=1.0.0
2020-08-16T06:43:36.9256946Z   Downloading identify-1.4.27-py2.py3-none-any.whl (97 kB)
2020-08-16T06:43:36.9588610Z Collecting toml
2020-08-16T06:43:36.9725788Z   Downloading toml-0.10.1-py2.py3-none-any.whl (19 kB)
2020-08-16T06:43:37.0989271Z Collecting virtualenv>=20.0.8
2020-08-16T06:43:37.1145994Z   Downloading virtualenv-20.0.30-py2.py3-none-any.whl (7.1 MB)
2020-08-16T06:43:38.0152862Z Collecting importlib-metadata; python_version < "3.8"
2020-08-16T06:43:38.0177537Z   Downloading importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB)
2020-08-16T06:43:38.0177865Z Collecting distlib<1,>=0.3.1
2020-08-16T06:43:38.0178467Z   Downloading distlib-0.3.1-py2.py3-none-any.whl (335 kB)
2020-08-16T06:43:38.0178729Z Collecting filelock<4,>=3.0.0
2020-08-16T06:43:38.0179286Z   Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
2020-08-16T06:43:38.0179548Z Collecting appdirs<2,>=1.4.3
2020-08-16T06:43:38.0180131Z   Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
2020-08-16T06:43:38.0180390Z Collecting six<2,>=1.9.0
2020-08-16T06:43:38.0180929Z   Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
2020-08-16T06:43:38.0181192Z Collecting zipp>=0.5
2020-08-16T06:43:38.0181722Z   Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB)
2020-08-16T06:43:38.0182313Z Using legacy 'setup.py install' for pyyaml, since package 'wheel' is not installed.
2020-08-16T06:43:38.0319503Z Installing collected packages: pyyaml, nodeenv, cfgv, identify, toml, distlib, filelock, zipp, importlib-metadata, appdirs, six, virtualenv, pre-commit
2020-08-16T06:43:38.0326635Z     Running setup.py install for pyyaml: started
2020-08-16T06:43:38.6402943Z     Running setup.py install for pyyaml: finished with status 'done'
2020-08-16T06:43:39.0824357Z Successfully installed appdirs-1.4.4 cfgv-3.2.0 distlib-0.3.1 filelock-3.0.12 identify-1.4.27 importlib-metadata-1.7.0 nodeenv-1.4.0 pre-commit-2.6.0 pyyaml-5.3.1 six-1.15.0 toml-0.10.1 virtualenv-20.0.30 zipp-3.1.0
2020-08-16T06:43:39.2010288Z WARNING: You are using pip version 20.2.1; however, version 20.2.2 is available.
2020-08-16T06:43:39.2042854Z You should consider upgrading via the '/opt/hostedtoolcache/Python/3.7.8/x64/bin/python -m pip install --upgrade pip' command.
2020-08-16T06:43:39.2651656Z [command]/opt/hostedtoolcache/Python/3.7.8/x64/bin/pip freeze --local
2020-08-16T06:43:39.5375732Z appdirs==1.4.4
2020-08-16T06:43:39.5376057Z cfgv==3.2.0
2020-08-16T06:43:39.5376311Z distlib==0.3.1
2020-08-16T06:43:39.5376534Z filelock==3.0.12
2020-08-16T06:43:39.5376740Z identify==1.4.27
2020-08-16T06:43:39.5377637Z importlib-metadata==1.7.0
2020-08-16T06:43:39.5377842Z nodeenv==1.4.0
2020-08-16T06:43:39.5378127Z pre-commit==2.6.0
2020-08-16T06:43:39.5378268Z PyYAML==5.3.1
2020-08-16T06:43:39.5378402Z six==1.15.0
2020-08-16T06:43:39.5378537Z toml==0.10.1
2020-08-16T06:43:39.5378671Z virtualenv==20.0.30
2020-08-16T06:43:39.5378803Z zipp==3.1.0
2020-08-16T06:43:39.5587434Z ##[endgroup]
2020-08-16T06:43:39.8715918Z Cache Size: ~4 MB (3838141 B)
2020-08-16T06:43:39.8776073Z [command]/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/b1396e8e-5c67-4a85-8167-d62c133a8342/cache.tzst -P -C /home/runner/work/aec/aec
2020-08-16T06:43:39.9252725Z [command]/opt/hostedtoolcache/Python/3.7.8/x64/bin/pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage push
2020-08-16T06:43:40.1320636Z [INFO]�[m Installing environment for https://github.com/pre-commit/pre-commit-hooks.
2020-08-16T06:43:40.1321452Z [INFO]�[m Once installed this environment will be reused.
2020-08-16T06:43:40.1321932Z [INFO]�[m This may take a few minutes...
2020-08-16T06:43:46.2113786Z [INFO]�[m Installing environment for https://github.com/ambv/black.
2020-08-16T06:43:46.2114763Z [INFO]�[m Once installed this environment will be reused.
2020-08-16T06:43:46.2115336Z [INFO]�[m This may take a few minutes...
2020-08-16T06:43:52.4403120Z [INFO]�[m Installing environment for https://github.com/timothycrosley/isort.
2020-08-16T06:43:52.4404223Z [INFO]�[m Once installed this environment will be reused.
2020-08-16T06:43:52.4404779Z [INFO]�[m This may take a few minutes...
2020-08-16T06:44:03.0601990Z [INFO]�[m Installing environment for https://github.com/myint/docformatter.
2020-08-16T06:44:03.0603064Z [INFO]�[m Once installed this environment will be reused.
2020-08-16T06:44:03.0603635Z [INFO]�[m This may take a few minutes...
2020-08-16T06:44:05.6382713Z [INFO]�[m Installing environment for https://gitlab.com/pycqa/flake8.
2020-08-16T06:44:05.6383306Z [INFO]�[m Once installed this environment will be reused.
2020-08-16T06:44:05.6383681Z [INFO]�[m This may take a few minutes...
2020-08-16T06:44:08.8771814Z Fix requirements.txt.....................................................�[42mPassed�[m
2020-08-16T06:44:09.6929032Z black....................................................................�[42mPassed�[m
2020-08-16T06:44:09.9845057Z isort....................................................................�[42mPassed�[m
2020-08-16T06:44:10.1022176Z docformatter.............................................................�[42mPassed�[m
2020-08-16T06:44:10.5480879Z flake8...................................................................�[42mPassed�[m
2020-08-16T06:45:14.7609697Z pyright..................................................................�[42mPassed�[m
2020-08-16T06:45:21.9077259Z test.....................................................................�[42mPassed�[m
2020-08-16T06:45:22.0309994Z Post job cleanup.
2020-08-16T06:45:22.1680787Z Cache hit occurred on the primary key Linux-venv-053a26dd7d441951bac15898aaf3e8af6091420afd43fb02b7ca3297fe1516b3, not saving cache.
2020-08-16T06:45:22.1750491Z Cleaning up orphan processes

My workflow:

name: Python application

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Cache virtualenv
      uses: actions/cache@v2
      with:
        path: ~/.virtualenvs
        key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.*') }}
    - uses: pre-commit/[email protected]
      with:
        extra_args: --all-files --hook-stage push  

Maybe the fact that I'm caching my virtualenv is somehow interfering with things?

Permission denied (publickey)

Just tried hooking this action up on a private repository based on the README:

    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

and I'm getting the following error:

/opt/hostedtoolcache/Python/3.8.1/x64/bin/pre-commit run --all-files --show-diff-on-failure --color=always
[INFO] Initializing environment for [email protected]:pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    [email protected]: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
Check the log at /home/runner/.cache/pre-commit/pre-commit.log
##[error]The process '/opt/hostedtoolcache/Python/3.8.1/x64/bin/pre-commit' failed with exit code 1
##[error]Node run failed with exit code 1

Any idea what I'm doing wrong?

pre-commit install fails with no .pre-commit-config.yaml in root directory

I have my .pre-commit-config.yaml file in a specific directory for my github actions.

While I can specify this config file location using extra_args, the installation of pre-commit fails.

I don't see a way to deal with this in the documentation, or while having a quick peek at the implementation.

My github workflow configuration:

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - name: Install Collections
      run: |
        sudo apt install software-properties-common
        sudo apt-add-repository --yes --update ppa:ansible/ansible
        sudo apt install ansible
        ansible-galaxy collection install -f -r .github/collections/requirements.yml
    - uses: pre-commit/[email protected]
      with:
        extra_args: -c .github/workflow-config/.pre-commit-config.yml

The relevant logging during the workflow failure:

> Run pre-commit/[email protected]
> install pre-commit
##[error]ENOENT: no such file or directory, open '.pre-commit-config.yaml'

Thanks for pre-commit and this action!

Loading cache fails with UnauthorizedRequestException

https://github.com/tox-dev/tox/runs/1310131531?check_suite_focus=true

Error: getCacheEntry failed: {"$id":"1","innerException":null,"message":"The user 'System:ServiceIdentity;DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}

Document maintenance status

If I read correctly on #70 I believe that it should be made clear the this action is unmaintained or at least deprecated. This means that a [deprecated] tag should be visible in project topic and github action.

action fails to install additional_dependencies with local hooks

On https://github.com/rdo-infra/queries/runs/1721441012?check_suite_focus=true I seen an error which makes be
believe that the pre-commit version used by the action is very old / buggy, as I was not able to reproduce this locally
with current versions (2.9.3).

queries-schema-validation................................................Failed
- hook id: queries-schema-validation
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/work/queries/queries/src/model.py", line 4, in <module>
    from pydantic import BaseModel, Field, Extra, HttpUrl
ModuleNotFoundError: No module named 'pydantic'

In my case that hook was defined as:

  - repo: local
    hooks:
      - id: queries-schema-validation
        name: queries-schema-validation
        entry: >
          bash -c "python src/model.py && cat src/data/queries.yml | yq | jsonschema -i /dev/stdin output/queries-schema.json"
        language: system
        pass_filenames: false
        always_run: true
        types: [python]
        additional_dependencies:
          - yq
          - pydantic
          - jsonschema

As seend above, dependencies are included but not really installed when run using the action.

GitLab Alternative

I started working with some GitLab codebases recently and was disappointed to not find a similar thing for their CI. I did look around, and if it's out there then I apologise for not finding it!

Would be interested in know where I might share this, if you think it is useful: https://gist.github.com/mattcanty/babff7e4770aa00d8ceaa312225a3b9a

It took me a little while to get right, especially the caching aspect. Note the golang image... the repo this comes from is a Go application. Therefore it is necessary for running Go pre-commit hooks. It appeared easier to use this image and install Python rather than the other way around.

Either way, I'm really happy to start using this pattern in GitLab as well.

Thanks

terraform_docs failing on TF0.12

This issue arises if the terraform module is on Terraform 12. I tested this on a different module that is not on terraform 12 and it worked fine. Is there a plan for this action to have an update that supports Terraform 12.

Screen Shot 2020-02-27 at 11 41 34 AM

Pin pre-commit version and cache python modules

By pinning the version of pre-commit, this action could provide consistent results even if latest pre-commit is updated.

Also would it be possible to cache the python modules installed when installing pre-commit? This could make this action way faster on repeating workflows.

Usage of this GitHub action together with the GitHub action from psf/black

Dear pre-commit devs,

I want to use your GitHub action action in my projects workflow together with the python code linter Black.

So far, I managed to make pre-commit work with the Black GitHub action as described in their doc (https://github.com/psf/black#github-actions). However, as far as I understand, this requires installing pre-commit on every machine. My desired scenario is having both action run (after each other?) such that this process is abstracted away from my co-workers.

At the moment, I have a .pre-commit-config.yaml file in the root directory, as well as a black.yml and pre-commit.yml in the.github/workflows directory

.pre-commit-config.yaml

repos:
  - repo: https://github.com/psf/black
    rev: 20.8b1
    hooks:
      - id: black
        language_version: python3.7

pre-commit.yml

name: Run pre-commit

on: [push, pull_request]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - uses: pre-commit/[email protected]

Unfortunately the action crashes (see attrached image). What am I missing / doing wrong?
GitHub Action Run

Action failed on commit if not PR

Action failed because it looks like script always expect to have pull_request object available in
const branch = github.context.payload.pull_request.head.ref;

Conflict between local pre-commit and github/action pre-commit

Locally, pre-commit passes just fine, however it fails with Github actions. black is reformatting on using github actions differently than on my machine. Any idea why that would be?

For the record, I already have

.pre-commit-config.yml

# https://pre-commit.com | https://pre-commit.com/hooks.html

repos:
-   repo: https://github.com/ambv/black
    rev: stable
    hooks:
        - id: black

-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.0.0
    hooks:
        - id: detect-private-key
        - id: trailing-whitespace
          types: [python]
        - id: check-yaml
        - id: check-added-large-files
          args: ['--maxkb=1024']
        - id: check-docstring-first
        - id: end-of-file-fixer
          types: [python]
        - id: name-tests-test
        - id: flake8

pyproject.toml

[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
    \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | _build
  | buck-out
  | build
  | dist
)/
'''

.github/workflows/pre-commit.yaml

name: pre-commit

on:
  pull_request:
  push:
    branches: [<branch-name>]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - uses: pre-commit/[email protected]

What am I missing?

Action fails to install pre-commit

Hi
I get the error:
Error: Unable to locate executable file: pre-commit, when i run pre-commit action.

The action seems fails to install pre-commit
https://github.com/JamesWoolfenden/terraform-aws-athena/runs/1848456616?check_suite_focus=true#step:3:1

Python is set to 3.8 but seems to install using pip and not pip3?
GHA config:

 security:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: master
          token: ${{ github.token }}
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: pre-commit/[email protected]

any help would be appreciated.

Auto-push fixes on private repo giving git errors

I've tried to use the auto-push feature on a private repository, following the example provided in the readme. I intentionally added whitespace black would want to format. I could see it took the stage of finding the error and then applying the change, but it failed to push. Here is the output I see:

Abbreviated log
2020-05-08T14:28:22.0373603Z ##[group]push fixes
2020-05-08T14:28:22.0392133Z [command]/usr/bin/git config user.name pre-commit
2020-05-08T14:28:22.0438691Z [command]/usr/bin/git config user.email [email protected]
2020-05-08T14:28:22.0488060Z [command]/usr/bin/git checkout HEAD -b aa/pre-commit-experiment
2020-05-08T14:28:22.1360913Z Switched to a new branch 'aa/pre-commit-experiment'
2020-05-08T14:28:22.1362037Z M  <snip>
2020-05-08T14:28:22.1386095Z [command]/usr/bin/git commit -am pre-commit fixes
2020-05-08T14:28:22.1510214Z [aa/pre-commit-experiment 7fb5999] pre-commit fixes
2020-05-08T14:28:22.1511534Z  1 file changed, 10 deletions(-)
2020-05-08T14:28:22.1525445Z [command]/usr/bin/git remote set-url origin ***github.com/Org/repo.git
2020-05-08T14:28:22.1580371Z [command]/usr/bin/git push origin HEAD
2020-05-08T14:28:22.7187413Z To https://github.com/Org/repo.git
2020-05-08T14:28:22.7188776Z  ! [rejected]        HEAD -> aa/pre-commit-experiment (fetch first)
2020-05-08T14:28:22.7190643Z error: failed to push some refs to '***github.com/Org/repo.git'
2020-05-08T14:28:22.7200342Z hint: Updates were rejected because the remote contains work that you do
2020-05-08T14:28:22.7219392Z hint: not have locally. This is usually caused by another repository pushing
2020-05-08T14:28:22.7242174Z hint: to the same ref. You may want to first integrate the remote changes
2020-05-08T14:28:22.7243172Z hint: (e.g., 'git pull ...') before pushing again.
2020-05-08T14:28:22.7243737Z hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Full log
2020-05-08T14:27:12.9169530Z ##[group]Run pre-commit/[email protected]
2020-05-08T14:27:12.9169693Z with:
2020-05-08T14:27:12.9170829Z   token: ***
2020-05-08T14:27:12.9170984Z env:
2020-05-08T14:27:12.9171082Z   pythonLocation: /opt/hostedtoolcache/Python/3.6.10/x64
2020-05-08T14:27:12.9171243Z   PY: cdad6b84a7996b35f072dbaccd3f1a043486e6f223ed58dfe31144098fdfe01c
2020-05-08T14:27:12.9171412Z ##[endgroup]
2020-05-08T14:27:12.9988261Z ##[group]install pre-commit
2020-05-08T14:27:13.0024653Z [command]/opt/hostedtoolcache/Python/3.6.10/x64/bin/pip install pre-commit
2020-05-08T14:27:17.7465023Z Collecting pre-commit
2020-05-08T14:27:17.7880383Z   Downloading pre_commit-2.3.0-py2.py3-none-any.whl (171 kB)
2020-05-08T14:27:17.9233005Z Collecting importlib-metadata; python_version < "3.8"
2020-05-08T14:27:17.9321929Z   Downloading importlib_metadata-1.6.0-py2.py3-none-any.whl (30 kB)
2020-05-08T14:27:17.9991889Z Collecting nodeenv>=0.11.1
2020-05-08T14:27:18.0075686Z   Downloading nodeenv-1.3.5-py2.py3-none-any.whl (21 kB)
2020-05-08T14:27:18.0496221Z Collecting cfgv>=2.0.0
2020-05-08T14:27:18.0581592Z   Downloading cfgv-3.1.0-py2.py3-none-any.whl (7.3 kB)
2020-05-08T14:27:18.1021643Z Collecting importlib-resources; python_version < "3.7"
2020-05-08T14:27:18.1109407Z   Downloading importlib_resources-1.5.0-py2.py3-none-any.whl (21 kB)
2020-05-08T14:27:18.2600601Z Collecting virtualenv>=15.2
2020-05-08T14:27:18.2688824Z   Downloading virtualenv-20.0.20-py2.py3-none-any.whl (4.7 MB)
2020-05-08T14:27:18.6567297Z Collecting identify>=1.0.0
2020-05-08T14:27:18.6658614Z   Downloading identify-1.4.15-py2.py3-none-any.whl (97 kB)
2020-05-08T14:27:18.7016313Z Collecting toml
2020-05-08T14:27:18.7099483Z   Downloading toml-0.10.0-py2.py3-none-any.whl (25 kB)
2020-05-08T14:27:18.7806327Z Collecting pyyaml>=5.1
2020-05-08T14:27:18.7893099Z   Downloading PyYAML-5.3.1.tar.gz (269 kB)
2020-05-08T14:27:19.8013961Z Collecting zipp>=0.5
2020-05-08T14:27:19.8098775Z   Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB)
2020-05-08T14:27:19.8533784Z Collecting filelock<4,>=3.0.0
2020-05-08T14:27:19.8621077Z   Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
2020-05-08T14:27:19.9233231Z Collecting appdirs<2,>=1.4.3
2020-05-08T14:27:19.9318355Z   Downloading appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
2020-05-08T14:27:20.0365382Z Collecting distlib<1,>=0.3.0
2020-05-08T14:27:20.0865424Z   Downloading distlib-0.3.0.zip (571 kB)
2020-05-08T14:27:20.6441711Z Collecting six<2,>=1.9.0
2020-05-08T14:27:20.6532294Z   Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
2020-05-08T14:27:20.7899219Z Installing collected packages: zipp, importlib-metadata, nodeenv, cfgv, importlib-resources, filelock, appdirs, distlib, six, virtualenv, identify, toml, pyyaml, pre-commit
2020-05-08T14:27:20.8998531Z     Running setup.py install for distlib: started
2020-05-08T14:27:21.3606943Z     Running setup.py install for distlib: finished with status 'done'
2020-05-08T14:27:21.6060352Z     Running setup.py install for pyyaml: started
2020-05-08T14:27:22.4852239Z     Running setup.py install for pyyaml: finished with status 'done'
2020-05-08T14:27:22.5823258Z Successfully installed appdirs-1.4.3 cfgv-3.1.0 distlib-0.3.0 filelock-3.0.12 identify-1.4.15 importlib-metadata-1.6.0 importlib-resources-1.5.0 nodeenv-1.3.5 pre-commit-2.3.0 pyyaml-5.3.1 six-1.14.0 toml-0.10.0 virtualenv-20.0.20 zipp-3.1.0
2020-05-08T14:27:22.7475982Z WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
2020-05-08T14:27:22.7477555Z You should consider upgrading via the '/opt/hostedtoolcache/Python/3.6.10/x64/bin/python -m pip install --upgrade pip' command.
2020-05-08T14:27:22.8030747Z [command]/opt/hostedtoolcache/Python/3.6.10/x64/bin/pip freeze --local
2020-05-08T14:27:23.0956595Z appdirs==1.4.3
2020-05-08T14:27:23.0957285Z cfgv==3.1.0
2020-05-08T14:27:23.0957450Z distlib==0.3.0
2020-05-08T14:27:23.0957557Z filelock==3.0.12
2020-05-08T14:27:23.0957699Z identify==1.4.15
2020-05-08T14:27:23.0958426Z importlib-metadata==1.6.0
2020-05-08T14:27:23.0958980Z importlib-resources==1.5.0
2020-05-08T14:27:23.0959108Z nodeenv==1.3.5
2020-05-08T14:27:23.0959337Z pre-commit==2.3.0
2020-05-08T14:27:23.0959445Z PyYAML==5.3.1
2020-05-08T14:27:23.0959548Z six==1.14.0
2020-05-08T14:27:23.0959653Z toml==0.10.0
2020-05-08T14:27:23.0959742Z virtualenv==20.0.20
2020-05-08T14:27:23.0959848Z zipp==3.1.0
2020-05-08T14:27:23.1268789Z ##[endgroup]
2020-05-08T14:27:23.1280093Z [command]/opt/hostedtoolcache/Python/3.6.10/x64/bin/pre-commit run --all-files --show-diff-on-failure --color=always
2020-05-08T14:27:25.3542590Z [INFO]�[m Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
2020-05-08T14:27:25.8536597Z [INFO]�[m Initializing environment for https://github.com/asottile/reorder_python_imports.
2020-05-08T14:27:26.1915388Z [INFO]�[m Initializing environment for https://github.com/psf/black.
2020-05-08T14:27:26.7866035Z [INFO]�[m Installing environment for https://github.com/pre-commit/pre-commit-hooks.
2020-05-08T14:27:26.7866514Z [INFO]�[m Once installed this environment will be reused.
2020-05-08T14:27:26.7866786Z [INFO]�[m This may take a few minutes...
2020-05-08T14:27:30.9411263Z [INFO]�[m Installing environment for https://github.com/asottile/reorder_python_imports.
2020-05-08T14:27:30.9412112Z [INFO]�[m Once installed this environment will be reused.
2020-05-08T14:27:30.9413170Z [INFO]�[m This may take a few minutes...
2020-05-08T14:27:33.3168773Z [INFO]�[m Installing environment for https://github.com/psf/black.
2020-05-08T14:27:33.3170634Z [INFO]�[m Once installed this environment will be reused.
2020-05-08T14:27:33.3171176Z [INFO]�[m This may take a few minutes...
2020-05-08T14:27:41.1313355Z Trim Trailing Whitespace.................................................�[42mPassed�[m
2020-05-08T14:27:41.8014356Z Check python ast.........................................................�[42mPassed�[m
2020-05-08T14:27:42.0515141Z Fix End of Files.........................................................�[42mPassed�[m
2020-05-08T14:27:42.5646551Z Check for added large files..............................................�[42mPassed�[m
2020-05-08T14:27:45.1916891Z Reorder python imports...................................................�[42mPassed�[m
2020-05-08T14:28:16.4987525Z black....................................................................�[41mFailed�[m
2020-05-08T14:28:16.4988380Z �[2m- hook id: black�[m
2020-05-08T14:28:16.4988880Z �[2m- files were modified by this hook�[m
2020-05-08T14:28:16.4989149Z 
2020-05-08T14:28:16.4989641Z �[1mreformatted /home/runner/work/<snip>�[0m
2020-05-08T14:28:16.4990136Z �[1mAll done! ✨ � ✨�[0m
2020-05-08T14:28:16.4990616Z �[1m1 file reformatted�[0m, 725 files left unchanged.�[0m
2020-05-08T14:28:16.4990887Z 
2020-05-08T14:28:16.5789614Z pre-commit hook(s) made changes.
2020-05-08T14:28:16.5790512Z If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
2020-05-08T14:28:16.5791050Z To run `pre-commit` as part of git workflow, use `pre-commit install`.
2020-05-08T14:28:16.5791474Z All changes made by hooks:
2020-05-08T14:28:16.6598222Z �[1mdiff --git a/<snip> b/<snip>�[m
2020-05-08T14:28:16.6599288Z �[1mindex 30889ec..cf230f7 100755�[m
2020-05-08T14:28:16.6599932Z �[1m--- a/<snip>�[m
2020-05-08T14:28:16.6600563Z �[1m+++ b/<snip>�[m
2020-05-08T14:28:16.6604054Z �[31m-�[m
2020-05-08T14:28:16.6604626Z �[31m-�[m
2020-05-08T14:28:16.6605199Z �[31m-�[m
2020-05-08T14:28:16.6605746Z �[31m-�[m
2020-05-08T14:28:16.6606346Z �[31m-�[m
2020-05-08T14:28:16.6606915Z �[31m-�[m
2020-05-08T14:28:16.6607478Z �[31m-�[m
2020-05-08T14:28:16.6608046Z �[31m-�[m
2020-05-08T14:28:16.6608591Z �[31m-�[m
2020-05-08T14:28:16.6609156Z �[31m-�[m
2020-05-08T14:28:16.6870075Z [command]/opt/hostedtoolcache/Python/3.6.10/x64/bin/pre-commit run --all-files --show-diff-on-failure --color=always
2020-05-08T14:28:17.6190699Z Trim Trailing Whitespace.................................................�[42mPassed�[m
2020-05-08T14:28:18.3156859Z Check python ast.........................................................�[42mPassed�[m
2020-05-08T14:28:18.5654865Z Fix End of Files.........................................................�[42mPassed�[m
2020-05-08T14:28:19.0271250Z Check for added large files..............................................�[42mPassed�[m
2020-05-08T14:28:21.3882729Z Reorder python imports...................................................�[42mPassed�[m
2020-05-08T14:28:21.9331623Z black....................................................................�[42mPassed�[m
2020-05-08T14:28:21.9574063Z [command]/usr/bin/git diff --quiet
2020-05-08T14:28:22.0373603Z ##[group]push fixes
2020-05-08T14:28:22.0392133Z [command]/usr/bin/git config user.name pre-commit
2020-05-08T14:28:22.0438691Z [command]/usr/bin/git config user.email [email protected]
2020-05-08T14:28:22.0488060Z [command]/usr/bin/git checkout HEAD -b aa/pre-commit-experiment
2020-05-08T14:28:22.1360913Z Switched to a new branch 'aa/pre-commit-experiment'
2020-05-08T14:28:22.1362037Z M  <snip>
2020-05-08T14:28:22.1386095Z [command]/usr/bin/git commit -am pre-commit fixes
2020-05-08T14:28:22.1510214Z [aa/pre-commit-experiment 7fb5999] pre-commit fixes
2020-05-08T14:28:22.1511534Z  1 file changed, 10 deletions(-)
2020-05-08T14:28:22.1525445Z [command]/usr/bin/git remote set-url origin ***github.com/Org/repo.git
2020-05-08T14:28:22.1580371Z [command]/usr/bin/git push origin HEAD
2020-05-08T14:28:22.7187413Z To https://github.com/Org/repo.git
2020-05-08T14:28:22.7188776Z  ! [rejected]        HEAD -> aa/pre-commit-experiment (fetch first)
2020-05-08T14:28:22.7190643Z error: failed to push some refs to '***github.com/Org/repo.git'
2020-05-08T14:28:22.7200342Z hint: Updates were rejected because the remote contains work that you do
2020-05-08T14:28:22.7219392Z hint: not have locally. This is usually caused by another repository pushing
2020-05-08T14:28:22.7242174Z hint: to the same ref. You may want to first integrate the remote changes
2020-05-08T14:28:22.7243172Z hint: (e.g., 'git pull ...') before pushing again.
2020-05-08T14:28:22.7243737Z hint: See the 'Note about fast-forwards' in 'git push --help' for details.
2020-05-08T14:28:22.7244580Z ##[endgroup]
2020-05-08T14:28:22.7247052Z ##[error]The process '/usr/bin/git' failed with exit code 1
2020-05-08T14:28:22.7331233Z Post job cleanup.
2020-05-08T14:28:22.8388183Z [command]/usr/bin/git version
2020-05-08T14:28:22.8435647Z git version 2.26.0
2020-05-08T14:28:22.8475985Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2020-05-08T14:28:22.8517266Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2020-05-08T14:28:22.8886719Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-05-08T14:28:22.8922895Z http.https://github.com/.extraheader
2020-05-08T14:28:22.8933353Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2020-05-08T14:28:22.8975811Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2020-05-08T14:28:22.9349031Z Cleaning up orphan processes
.github/workflows/pre-commit.yml
name: pre-commit

on:
  pull_request:
  push:
    branches: [develop]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: 3.6
    - name: set PY
      run: echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' ' -f1)"
    - uses: actions/cache@v1
      with:
        path: ~/.cache/pre-commit
        key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

Any ideas?

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.