Skip to content

Commit

Permalink
Convert to composite action #10 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibiqlik committed Nov 8, 2020
1 parent 76fdac3 commit b2aeacc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
18 changes: 10 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"

0 comments on commit b2aeacc

Please sign in to comment.