Skip to content

Update update_detector.yml #85

Update update_detector.yml

Update update_detector.yml #85

Workflow file for this run

name: Hadolint
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
MONITORED_FILES: "Dockerfile"
permissions: write-all
jobs:
init:
runs-on: ubuntu-latest
name: Initialize addons to lint
outputs:
changed_addons: ${{ steps.changed_addons.outputs.addons }}
changed: ${{ steps.changed_addons.outputs.changed }}
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Get changed files
id: changed_files
uses: UplandJacob2/[email protected]
- name: Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master
- name: Get changed add-ons
id: changed_addons
run: |
declare -a changed_addons
for addon in ${{ steps.addons.outputs.addons }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then
for file in ${{ env.MONITORED_FILES }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then
if [[ ! "${changed_addons[@]}" =~ $addon ]]; then
changed_addons+=("\"${addon}\",");
fi
fi
done
fi
done
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
if [[ -n ${changed} ]]; then
echo "Changed add-ons: $changed";
echo "changed=true" >> $GITHUB_OUTPUT;
echo "addons=[$changed]" >> $GITHUB_OUTPUT;
else
echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})";
fi
lint:
needs: init
runs-on: ubuntu-latest
if: needs.init.outputs.changed == 'true'
name: Lint ${{ matrix.addon }} add-on Dockerfile
strategy:
matrix:
addon: ${{ fromJson(needs.init.outputs.changed_addons) }}
fail-fast: false
steps:
# - name: Dump github context
# run: echo "$GITHUB_CONTEXT"
# shell: bash
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Check out repository
uses: actions/[email protected]
- name: Run Hadolint
uses: hadolint/[email protected]
with:
dockerfile: "./${{ matrix.addon }}/Dockerfile"
#config:
#recursive:
#output-file: # optional, default is /dev/stdout
#no-color: true
#no-fail: true
#verbose: true
# The output format, one of [tty (default) | json | checkstyle | codeclimate | gitlab_codeclimate | codacy | sarif]
#format:
# Fail the pipeline only if rules with severity above this threshold are violated. One of [error | warning | info (default) | style | ignore]
failure-threshold: "warning"
# A comma separated list of rules whose severity will be `error`
#override-error:
# A comma separated list of rules whose severity will be `warning`
#override-warning:
# A comma separated list of rules whose severity will be `info`
#override-info:
# A comma separated list of rules whose severity will be `style`
#override-style:
# A comma separated string of rules to ignore
ignore: "DL3006"
# A comma separated list of trusted registry urls
#trusted-registries: