Set PWD and HOME environment variables accordingly

This commit is contained in:
kgrv-me 2022-05-14 19:16:32 +07:00
parent eeab5ede16
commit 6eded94cd6
3 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,8 @@
FROM ghcr.io/hadolint/hadolint:v2.10.0-debian
# Set default WORKDIR in Dockerfile for easier trace and consistency
WORKDIR /github/workspace
COPY LICENSE README.md problem-matcher.json /
COPY hadolint.sh /usr/local/bin/hadolint.sh

View file

@ -26,7 +26,7 @@ steps:
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------|--------------------|
| `dockerfile` | The path to the Dockerfile to be tested | `./Dockerfile` |
| `recursive` | Search for specified dockerfile </br> recursively, from the project root | `false` |
| `config` | Custom path to a Hadolint config file | `./.hadolint.yaml` |
| `config` | Custom path to a Hadolint config file | |
| `output-file` | A sub-path where to save the </br> output as a file to | |
| `no-color` | Don't create colored output (`true`/`false`) | |
| `no-fail` | Never fail the action (`true`/`false`) | |

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Set essential environment variables in the container
export {PWD,HOME}=$(pwd)
# The problem-matcher definition must be present in the repository
# checkout (outside the Docker container running hadolint). We copy
# problem-matcher.json to the home folder.
@ -16,7 +19,7 @@ trap cleanup EXIT
echo "::add-matcher::$HOME/problem-matcher.json"
if [ -n "$HADOLINT_CONFIG" ]; then
HADOLINT_CONFIG="-c ${HADOLINT_CONFIG}"
HADOLINT_CONFIG="-c ${PWD}/${HADOLINT_CONFIG}"
fi
if [ -z "$HADOLINT_TRUSTED_REGISTRIES" ]; then