-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
118 lines (118 loc) · 4.53 KB
/
Copy pathaction.yml
File metadata and controls
118 lines (118 loc) · 4.53 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: PPTLint check
description: Check whether a PowerPoint file is ready to send and upload offline HTML and JSON reports.
author: Kdnsna
branding:
icon: check-circle
color: orange
inputs:
path:
description: PPTX file to audit.
required: true
profile:
description: baseline or ai-generated.
default: baseline
fail-on:
description: none, low, medium, high, or critical.
default: high
min-score:
description: Optional minimum overall score from 0 to 100.
default: ""
renderer:
description: auto, wireframe, or libreoffice.
default: wireframe
scenario:
description: present, screen, or document.
default: present
language:
description: en or zh-CN.
default: en
report-mode:
description: full or shareable. CI defaults to redacted artifacts.
default: shareable
policy:
description: Optional repository-relative delivery policy path.
default: ""
artifact-name:
description: Uploaded report artifact name.
default: pptlint-report
outputs:
readiness:
description: "Delivery result: ready, review, or blocked."
value: ${{ steps.audit.outputs.readiness }}
score:
description: Secondary PPTLint trend score.
value: ${{ steps.audit.outputs.score }}
html-report:
description: Path to the generated HTML report.
value: ${{ steps.audit.outputs.html-report }}
json-report:
description: Path to the generated JSON report.
value: ${{ steps.audit.outputs.json-report }}
repair-plan:
description: Path to the complete machine-readable repair plan.
value: ${{ steps.audit.outputs.repair-plan }}
exit-code:
description: PPTLint CLI exit code (0 pass, 1 changes required, 2 operational error).
value: ${{ steps.audit.outputs.exit-code }}
runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PPTLint from this action ref
shell: bash
run: python -m pip install "$GITHUB_ACTION_PATH"
- name: Check PowerPoint
id: audit
continue-on-error: true
shell: bash
env:
INPUT_PATH: ${{ inputs.path }}
INPUT_PROFILE: ${{ inputs.profile }}
INPUT_FAIL_ON: ${{ inputs.fail-on }}
INPUT_MIN_SCORE: ${{ inputs.min-score }}
INPUT_RENDERER: ${{ inputs.renderer }}
INPUT_SCENARIO: ${{ inputs.scenario }}
INPUT_LANGUAGE: ${{ inputs.language }}
INPUT_REPORT_MODE: ${{ inputs.report-mode }}
INPUT_POLICY: ${{ inputs.policy }}
run: |
report_dir=$(mktemp -d "$RUNNER_TEMP/pptlint.XXXXXX")
report_prefix="$report_dir/pptlint-report"
html_report="$report_prefix.html"
json_report="$report_prefix.json"
repair_plan="$report_dir/pptlint-repair-plan.json"
args=(pptlint check "$INPUT_PATH" --profile "$INPUT_PROFILE" --scenario "$INPUT_SCENARIO" --lang "$INPUT_LANGUAGE" --report-mode "$INPUT_REPORT_MODE" --fail-on "$INPUT_FAIL_ON" --renderer "$INPUT_RENDERER" --output "$report_prefix")
if [[ -n "$INPUT_MIN_SCORE" ]]; then args+=(--min-score "$INPUT_MIN_SCORE"); fi
if [[ -n "$INPUT_POLICY" ]]; then args+=(--policy "$INPUT_POLICY"); fi
set +e
"${args[@]}"
status=$?
set -e
score=$(JSON_REPORT="$json_report" python -c 'import json, os; print(json.load(open(os.environ["JSON_REPORT"]))["scores"]["overall"])' 2>/dev/null || printf '0')
readiness=$(JSON_REPORT="$json_report" python -c 'import json, os; print(json.load(open(os.environ["JSON_REPORT"]))["readiness"]["status"])' 2>/dev/null || printf 'error')
if [[ -f "$json_report" ]]; then
pptlint plan "$json_report" --format json --output "$repair_plan"
fi
printf 'readiness=%s\n' "$readiness" >> "$GITHUB_OUTPUT"
printf 'score=%s\n' "$score" >> "$GITHUB_OUTPUT"
printf 'html-report=%s\n' "$html_report" >> "$GITHUB_OUTPUT"
printf 'json-report=%s\n' "$json_report" >> "$GITHUB_OUTPUT"
printf 'repair-plan=%s\n' "$repair_plan" >> "$GITHUB_OUTPUT"
printf 'exit-code=%s\n' "$status" >> "$GITHUB_OUTPUT"
- name: Upload PPTLint reports
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: |
${{ steps.audit.outputs.html-report }}
${{ steps.audit.outputs.json-report }}
${{ steps.audit.outputs.repair-plan }}
if-no-files-found: warn
- name: Enforce quality gate
if: always()
shell: bash
run: exit "${{ steps.audit.outputs.exit-code }}"