Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: check-json
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.0.0-beta.1
rev: v8.26.0
hooks:
- id: eslint
args: [--fix]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dist/index.js: index.js node_modules
node_modules/.bin/webpack --config webpack.config.js
# terrible hack to prevent lookup of `navigator`
# if someone knows the correct way to use webpack, PRs welcome!
sed -i 's/\bnavigator\b/({})/g' $@
# sed -i 's/\bnavigator\b/({})/g' $@

.PHONY: push
push: venv
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ inputs:
default: 'pre-commit fixes'

runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
16 changes: 2 additions & 14 deletions dist/index.js

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('fs');
const os = require('os');
const path = require('path');

const cache = require('@actions/cache');
const core = require('@actions/core');
const exec = require('@actions/exec');
const github = require('@actions/github');
Expand Down Expand Up @@ -51,27 +50,7 @@ async function main() {
const pr = github.context.payload.pull_request;
const push = !!token && !!pr;

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 restored = await cache.restoreCache(cachePaths, cacheKey);
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
if (!restored) {
try {
await cache.saveCache(cachePaths, cacheKey);
} catch (e) {
core.warning(
`There was an error saving the pre-commit environments to cache:

${e.message || e}

This only has performance implications and won't change the result of your pre-commit tests.
If this problem persists on your default branch, you can try to fix it by editing your '.pre-commit-config.yaml'.
For example try to run 'pre-commit autoupdate' or simply add a blank line.
This will result in a different hash value and thus a different cache target.`.replace(/^ +/gm, '')
);
}
}

if (ret && push) {
// actions do not run on pushes made by actions.
Expand Down
Loading