-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
88 lines (77 loc) · 2.55 KB
/
action.yml
File metadata and controls
88 lines (77 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Devolv Action
description: Run Devolv DevOps Toolkit tools (drift, validate) in GitHub Actions
inputs:
tool:
description: Which Devolv tool to run (e.g. drift, validate)
required: true
policy-name:
description: IAM policy name (required for drift)
required: false
path:
description: Path to the local policy file or directory
required: true
github-token:
description: GitHub token to use for API calls
required: true
fail-on-high-risk:
description: Whether to fail the job if high-risk findings are detected (for validate)
required: false
default: "true"
approvers:
description: Comma-separated GitHub usernames for approval issue (optional)
required: false
approval-anyway:
description: Force approval even if no drift detected
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Install Devolv silently
run: |
python -m pip install --quiet --disable-pip-version-check devolv==0.2.40
shell: bash
- name: Run Devolv tool
run: |
set -e
export GITHUB_TOKEN="${{ inputs.github-token }}"
if [ -z "${{ inputs.path }}" ]; then
echo "::error::❌ Path input is required but was not provided."
exit 1
fi
case "${{ inputs.tool }}" in
drift)
if [ ! -f "${{ inputs.path }}" ]; then
echo "::error::❌ Drift requires a file path. '${{ inputs.path }}' is not a file."
exit 1
fi
ARGS="--policy-name \"${{ inputs.policy-name }}\" --file \"${{ inputs.path }}\""
if [ -n "${{ inputs.approvers }}" ]; then
ARGS="$ARGS --approvers \"${{ inputs.approvers }}\""
fi
if [ "${{ inputs.approval-anyway }}" = "true" ]; then
ARGS="$ARGS --approval-anyway"
fi
eval devolv drift $ARGS
;;
validate)
echo "::group::Running Devolv validate"
if devolv validate "${{ inputs.path }}" --json | tee validate.json | grep -q '"level": "high"'; then
cat validate.json
echo "::error::❌ High-risk findings detected"
exit 1
else
cat validate.json
echo "✅ No high-risk findings."
fi
echo "::endgroup::"
;;
*)
echo "::error::❌ Unknown tool: '${{ inputs.tool }}'"
exit 1
;;
esac
shell: bash
branding:
icon: 'shield'
color: 'blue'