Convert to composite action #10

This commit is contained in:
Ilir Bekteshi 2020-08-25 11:40:50 +02:00 committed by Ilir Bekteshi
parent 76fdac3839
commit da29517235
4 changed files with 23 additions and 21 deletions

View file

@ -13,10 +13,10 @@ jobs:
DOCKER_IMAGE: ilirbekteshi/action-yamllint
DOCKER_FILE: Dockerfile
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker build . --file $DOCKER_FILE -t $DOCKER_IMAGE:$GITHUB_SHA -t $DOCKER_IMAGE:latest
docker push $DOCKER_IMAGE:$GITHUB_SHA
docker push $DOCKER_IMAGE:latest
- uses: actions/checkout@v1
- name: Build the Docker image
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker build . --file $DOCKER_FILE -t $DOCKER_IMAGE:$GITHUB_SHA -t $DOCKER_IMAGE:latest
docker push $DOCKER_IMAGE:$GITHUB_SHA
docker push $DOCKER_IMAGE:latest

View file

@ -7,7 +7,7 @@ This action executes `yamllint` (https://github.com/adrienverge/yamllint) agains
Simple as:
```yaml
- uses: ibiqlik/action-yamllint@v2
- uses: ibiqlik/action-yamllint@v3
```
### Optional parameters
@ -22,6 +22,8 @@ Simple as:
- `format` - Format for parsing output [parsable,standard,colored,github,auto] (default: github)
- `strict` - Return non-zero exit code on warnings as well as errors [true,false] (default: false)
**Note:** If `.yamllint` configuration file exists in your root folder, yamllint will automatically use it.
### Example usage in workflow
```yaml
@ -33,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: yaml-lint
uses: ibiqlik/action-yamllint@v2
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: myfolder/*values*.yaml
config_file: .yamllint.yml
@ -50,11 +52,9 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: yaml-lint
uses: ibiqlik/action-yamllint@v2
uses: ibiqlik/action-yamllint@v3
```
**Note:** Action will use `.yamllint` as configuration file automatically if it is available in root.
Config data examples:
```yaml

View file

@ -22,14 +22,16 @@ inputs:
default: "false"
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.file_or_dir }}
- ${{ inputs.config_file }}
- ${{ inputs.config_data }}
- ${{ inputs.format }}
- ${{ inputs.strict }}
using: 'composite'
steps:
- run: ${{ github.action_path }}/entrypoint.sh
shell: bash
env:
INPUT_FILE_OR_DIR: ${{ inputs.file_or_dir }}
INPUT_CONFIG_FILE: ${{ inputs.config_file }}
INPUT_CONFIG_DATA: ${{ inputs.config_data }}
INPUT_FORMAT: ${{ inputs.format }}
INPUT_STRICT: ${{ inputs.strict }}
branding:
color: blue

View file

@ -21,7 +21,7 @@ fi
# Enable globstar so ** globs recursively
shopt -s globstar
# Use the current directory by default
options+=(${INPUT_FILE_OR_DIR:-.})
options+=("${INPUT_FILE_OR_DIR:-.}")
shopt -u globstar
yamllint "${options[@]}"