Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acdha/pre-commit-docker
https://pre-commit.com/ packaged as a Docker image for CI
https://github.com/acdha/pre-commit-docker
code-quality docker github-actions gitlab-ci pre-commit qa
Last synced: 2 months ago
JSON representation
https://pre-commit.com/ packaged as a Docker image for CI
- Host: GitHub
- URL: https://github.com/acdha/pre-commit-docker
- Owner: acdha
- License: other
- Created: 2019-08-26T17:00:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T21:32:08.000Z (3 months ago)
- Last Synced: 2024-10-31T04:50:44.209Z (2 months ago)
- Topics: code-quality, docker, github-actions, gitlab-ci, pre-commit, qa
- Language: Dockerfile
- Homepage:
- Size: 37.1 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit Docker packaging
This is just enough Docker to run [pre-commit](https://pre-commit.com) as a CI
stage.Because they are on use on many projects, the following dependencies are
pre-installed:- terraform
- terraform-docs## Usage
### Docker
```bash
$ docker run -it --rm --volume "$(pwd)":/code acdha/pre-commit:latest
…
```### GitLab CI
#### Recommended: shared template on LC GitLab
To avoid needing to update the configuration in the future, you can simply
include the template from this repository to run pre-commit during your
project's `validate` stage:```yaml
include:
- project: devops/pre-commit-docker
file: templates/pre-commit.yml
```If you want to run during a different stage, you can override the default:
```yaml
include:
- project: devops/pre-commit-docker
file: templates/pre-commit.ymlprecommit:
stage: test
```#### Alternate (previous usage)
If you want more control over exactly how the job is run you can configure the
job directly:```yaml
precommit:
image:
name: git.loc.gov:4567/devops/pre-commit-docker/master:latest
entrypoint: [""]
script:
- exec /usr/local/bin/run-pre-commit
```### GitHub Actions
```yaml
name: CIon:
push:
branches:
- masterjobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Fetch pre-commit Docker image
env:
PRE_COMMIT_ACCESS_TOKEN: ${{ secrets.PRE_COMMIT_ACCESS_TOKEN }}
run: |
docker login docker.pkg.github.com -u acdha -p ${PRE_COMMIT_ACCESS_TOKEN}
docker pull docker.pkg.github.com/acdha/pre-commit-docker/pre-commit-docker:master
- name: Run pre-commit
run: |
docker run --volume "$PWD":/code docker.pkg.github.com/acdha/pre-commit-docker/pre-commit-docker:master
```