Skip to content

Commit

Permalink
Add parameter to set puppet or pe version for validation run
Browse files Browse the repository at this point in the history
  • Loading branch information
TuningYourCode committed Dec 4, 2020
1 parent a45ce05 commit 31b5407
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# action-pdk-validate

This action runs `pdk validate` on your puppet module codebase and fails the step if there are test failures.
This action runs `pdk validate` on your puppet module codebase and fails the step if there are static validation failures.

## Usage

To use the action add the following step to your workflow file (e.g. `.github/workflows/main.yml`)
To use the action add the following step to your workflow file (e.g. `.github/workflows/pdk-validate.yml`)

```yaml
name: Run static validation
name: Run pdk static validation

on:
- push
Expand All @@ -20,6 +20,13 @@ jobs:
- name: Clone repository
uses: actions/checkout@v2

- name: Run static validation and save report to junit xml
uses: puppet-enterprise-support-team/action-pdk-validate@v1
- name: Run pdk validate
uses: puppets-epic-show-theatre/action-pdk-validate@v1
with:
puppet-version: ""
# [optional]
# A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
pe-version: ""
# [optional]
# A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".
```
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
---
name: action-pdk-validate
description: Runs `pdk validate` on your puppet module code
inputs:
puppet-version:
description: A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
required: false
pe-version:
description: A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".
required: false
branding:
icon: check-square
color: orange
runs:
using: docker
image: Dockerfile
env:
PUPPET_VERSION: ${{ inputs.puppet-version }}
PE_VERSION: ${{ inputs.pe-version }}
10 changes: 8 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -x

mkdir -p junit-tests/
if [ -n "$PUPPET_VERSION" ]; then
additional_opts="--puppet-version $PUPPET_VERSION"
elif [ -n "$PE_VERSION" ]; then
additional_opts="--pe-version $PE_VERSION"
else
additional_opts=""
fi

pdk validate --format=text
pdk validate --format=text $additional_opts

0 comments on commit 31b5407

Please sign in to comment.