diff --git a/.github/workflows/test-exclusions.yml b/.github/workflows/test-exclusions.yml new file mode 100644 index 0000000..8101f1a --- /dev/null +++ b/.github/workflows/test-exclusions.yml @@ -0,0 +1,28 @@ +name: Test Exclusions + +on: + pull_request: + push: + +jobs: + test-exclusions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Test Local Action (debug log) + uses: ./ + env: + LOG_LEVEL: DEBUG + CREATE_LOG_FILE: true + GITHUB_WORKSPACE: test/exclusion-test + with: + exclude-patterns: 'template' + - name: Test Local Action (debug log) + uses: ./ + env: + LOG_LEVEL: DEBUG + CREATE_LOG_FILE: true + GITHUB_WORKSPACE: test/exclusion-test + with: + exclude-patterns: 'template' + deny-warnings: 'true' diff --git a/action.yml b/action.yml index 7cf656e..543d59b 100644 --- a/action.yml +++ b/action.yml @@ -25,8 +25,7 @@ runs: using: "docker" image: "Dockerfile" entrypoint: "/app/entrypoint.sh" - args: - - ${{ inputs.lint == 'true' && '--lint' || '' }} - - ${{ inputs.deny-warnings == 'true' && '--deny-warnings' || '' }} - - ${{ inputs.deny-notes == 'true' && '--deny-notes' || '' }} - - ${{ inputs.exclude-patterns }} + env: + INPUT_PATTERNS: ${{ inputs.exclude-patterns }} + INPUT_WARNINGS: ${{ inputs.deny-warnings }} + INPUT_NOTES: ${{ inputs.deny-notes }} diff --git a/entrypoint.sh b/entrypoint.sh index ab5a555..7cf3ff4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,21 +1,24 @@ #!/bin/bash lint="" + +if [ $INPUT_LINT = "true" ]; then + lint="--lint" +fi + warnings="" + +if [ ${INPUT_WARNINGS} = "true" ]; then + warnings="--deny-warnings" +fi + notes="" -while [ "$#" -gt 0 ]; do - arg=$1 - case $1 in - -l|--lint) lint="--lint"; shift;; - -w|--deny-warnings) warnings="--deny-warnings"; shift;; - -n|--deny-notes) notes="--deny-notes"; shift;; - ''|"") shift;; - *) break;; - esac -done +if [ ${INPUT_NOTES} = "true" ]; then + notes="--deny-notes" +fi -exclusions=$1 +exclusions=${INPUT_PATTERNS} if [ -n "$exclusions" ]; then echo "Exclusions provided. Writing to .sprocket.yml." diff --git a/test/exclusion-test/ok.wdl b/test/exclusion-test/ok.wdl new file mode 100644 index 0000000..86fda2f --- /dev/null +++ b/test/exclusion-test/ok.wdl @@ -0,0 +1,24 @@ +#@ except: LineWidth + +version 1.1 + +task foo { + meta { + description: "test task" + outputs: { + out: "output file" + } + } + + command <<< + echo "hello" > out + >>> + + output { + File out = "out" + } + + runtime { + container: "ubuntu@sha256:67541378af7d535606e684a8234d56ca0725b6a4d8b0bbf19cebefed98e06f42" + } +} diff --git a/test/exclusion-test/template.wdl b/test/exclusion-test/template.wdl new file mode 100644 index 0000000..e69de29