From b2aeacc1b7eeb8c23e84bba320d04fb5d6a323ee Mon Sep 17 00:00:00 2001 From: Ilir Bekteshi Date: Sun, 8 Nov 2020 18:54:33 +0100 Subject: [PATCH] Convert to composite action #10 (#11) --- .github/workflows/dockerimage.yml | 14 +++++++------- README.md | 10 +++++----- action.yml | 18 ++++++++++-------- entrypoint.sh | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 98b71c6..31a2a3e 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -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 diff --git a/README.md b/README.md index b09df54..f49c1cd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index 896163a..4e286da 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index f3fbfc7..d2687fe 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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[@]}"