Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use environment args #3

Merged
merged 9 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/test-exclusions.yml
Original file line number Diff line number Diff line change
@@ -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'
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
25 changes: 14 additions & 11 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
24 changes: 24 additions & 0 deletions test/exclusion-test/ok.wdl
Original file line number Diff line number Diff line change
@@ -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"
}
}
Empty file.
Loading