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
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
build:
if: false # disable for now
name: pr
runs-on: ubuntu-latest
steps:
Expand All @@ -19,3 +20,4 @@ jobs:
- run: make push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
nitrocode/pre-commit-action
cloudposse/github-action-pre-commit
=================

A GitHub action to run [pre-commit](https://pre-commit.com)

__NOTE:__ This is a fork of [pre-commit/action](https://github.com/pre-commit/action) to add additional features.

### using this action

To use this action, make a file `.github/workflows/pre-commit.yml`. Here's a
Expand All @@ -22,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: nitrocode/pre-commit-action@v2.1.0
- uses: cloudposse/github-action-pre-commit@v2
```

This does a few things:
Expand All @@ -40,7 +42,7 @@ 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):

```yaml
- uses: nitrocode/pre-commit-action@v2.1.0
- uses: cloudposse/github-action-pre-commit@v2
with:
extra_args: flake8 --all-files
```
Expand All @@ -65,11 +67,12 @@ pushing
next is passing the token to the pre-commit action

```yaml
- uses: nitrocode/pre-commit-action@v2.1.0
- uses: cloudposse/github-action-pre-commit@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
git_user_name: pre-commit
git_user_email: pre-commit@example.com
git_commit_message: "pre-commit fixes"
```

note that `secrets.GITHUB_TOKEN` is automatically provisioned and will not
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: pre-commit
name: cloudposse-pre-commit
description: run pre-commit and optionally commit back to the pull request
author: 'Cloud Posse <hello@cloudposse.com>'
branding:
icon: 'activity'
color: 'blue'
inputs:
extra_args:
description: options to pass to pre-commit run
Expand All @@ -16,6 +20,10 @@ inputs:
description: github user email to push with
required: false
default: 'pre-commit@example.com'
git_commit_message:
description: github commit message to push with
required: false
default: 'pre-commit fixes'

runs:
using: 'node12'
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function main() {
const token = core.getInput('token');
const git_user_name = core.getInput('git_user_name');
const git_user_email = core.getInput('git_user_email');
const git_commit_message = core.getInput('git_commit_message');
const pr = github.context.payload.pull_request;
const push = !!token && !!pr;

Expand Down Expand Up @@ -91,7 +92,7 @@ async function main() {
const branch = pr.head.ref;
await exec.exec('git', ['checkout', 'HEAD', '-B', branch]);

await exec.exec('git', ['commit', '-am', 'pre-commit fixes']);
await exec.exec('git', ['commit', '-am', git_commit_message]);
const url = addToken(pr.head.repo.clone_url, token);
await exec.exec('git', ['push', url, 'HEAD']);
});
Expand Down