Skip to content

Commit

Permalink
Merge pull request #16 from depot/feat/lint
Browse files Browse the repository at this point in the history
feat(lint): add lint flags
  • Loading branch information
goller authored May 31, 2023
2 parents c8f5fe8 + 11d2319 commit d648877
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 135 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ This action needs a Depot API token to communicate with your project's builders.
| `token` | String | You must authenticate with the Depot API to communicate with your projects builders ([see Authentication above](#authentication)) |
| `build-platform` | String | The platform to use for the build ( `linux/amd64` or `linux/arm64`) |
| `buildx-fallback` | Boolean | If true, this action will fallback to using `docker buildx build` if `depot build` is unable to acquire a builder connection. This requires installing buildx with [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action) (default: `false`) |
| `lint` | Boolean | Lint dockerfiles and fail build if any issues are of `error` severity. (default `false`) |
| `lint-fail-on` | String | Severity of linter issue to cause the build to fail. (`error`, `warn`, `info`, `none`) |

### General inputs

Expand Down Expand Up @@ -281,6 +283,7 @@ jobs:
- [Build and push image to GCP Artifact Registry](/docs/build-and-push-artifact-registry.md)
- [Build and push to multiple registries](/docs/build-and-push-multiple.md)
- [Export image to Docker](/docs/export-to-docker.md)
- [Lint and Build image](/docs/lint-and-build.md)

## License

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ inputs:
labels:
description: 'List of metadata for an image'
required: false
lint:
description: 'Lint dockerfiles and fail build if any issues are at least the lint-fail-on severity'
required: false
lint-fail-on:
description: 'Severity of linter issue to cause the build to fail. (e.g., error, warn, info, none)'
required: false
load:
description: 'Load is a shorthand for --output=type=docker'
required: false
Expand Down
22 changes: 11 additions & 11 deletions dist/index.js

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions docs/lint-and-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```yaml
name: Lint and Build image

on:
push:
branches:
- main

jobs:
docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Lint and Build
uses: depot/build-push-action@v1
with:
# if no depot.json file is at the root of your repo, you must specify the project id
project: <your-depot-project-id>
lint: true
# Fail build on info, warning, and error linter issues
lint-fail-on: info
tags: user/app:latest
```
Loading

0 comments on commit d648877

Please sign in to comment.