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_IMAGE: ilirbekteshi/action-yamllint
DOCKER_FILE: Dockerfile DOCKER_FILE: Dockerfile
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build the Docker image - name: Build the Docker image
run: | run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} 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 build . --file $DOCKER_FILE -t $DOCKER_IMAGE:$GITHUB_SHA -t $DOCKER_IMAGE:latest
docker push $DOCKER_IMAGE:$GITHUB_SHA docker push $DOCKER_IMAGE:$GITHUB_SHA
docker push $DOCKER_IMAGE:latest docker push $DOCKER_IMAGE:latest

View file

@ -7,7 +7,7 @@ This action executes `yamllint` (https://github.com/adrienverge/yamllint) agains
Simple as: Simple as:
```yaml ```yaml
- uses: ibiqlik/action-yamllint@v2 - uses: ibiqlik/action-yamllint@v3
``` ```
### Optional parameters ### Optional parameters
@ -22,6 +22,8 @@ Simple as:
- `format` - Format for parsing output [parsable,standard,colored,github,auto] (default: github) - `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) - `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 ### Example usage in workflow
```yaml ```yaml
@ -33,7 +35,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: yaml-lint - name: yaml-lint
uses: ibiqlik/action-yamllint@v2 uses: ibiqlik/action-yamllint@v3
with: with:
file_or_dir: myfolder/*values*.yaml file_or_dir: myfolder/*values*.yaml
config_file: .yamllint.yml config_file: .yamllint.yml
@ -50,11 +52,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: yaml-lint - 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: Config data examples:
```yaml ```yaml

View file

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

View file

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