-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
125 lines (108 loc) · 3.64 KB
/
action.yml
File metadata and controls
125 lines (108 loc) · 3.64 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
119
120
121
122
123
124
125
name: 'QualOps Code Quality Analysis'
description: 'AI-powered code quality analysis with PR comments and GitHub Checks integration'
branding:
icon: 'check-circle'
color: 'blue'
inputs:
anthropic-api-key:
description: 'Anthropic API key for Claude AI'
required: true
github-token:
description: 'GitHub token for API access'
required: false
default: ${{ github.token }}
config-path:
description: 'Path to .qualopsrc.json config file'
required: false
default: '.qualops/.qualopsrc.json'
stages:
description: 'Comma-separated list of stages to run (analyze,review,fix,report,judge)'
required: false
default: 'analyze,review,judge,report'
base-ref:
description: 'Base branch or commit for comparison'
required: false
default: ''
files:
description: 'Specific files or patterns to analyze (comma-separated)'
required: false
default: ''
outputs:
total-issues:
description: 'Total number of issues found'
critical-issues:
description: 'Number of critical severity issues'
high-issues:
description: 'Number of high severity issues'
quality-passed:
description: 'Whether quality thresholds were met (true/false)'
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install and build QualOps
shell: bash
run: |
cd "${{ github.action_path }}"
npm ci
npm run build
- name: Run QualOps Analysis
shell: bash
env:
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
cd "$GITHUB_WORKSPACE"
ARGS="--config=${{ inputs.config-path }}"
if [ -n "${{ inputs.base-ref }}" ]; then
ARGS="$ARGS --base=${{ inputs.base-ref }}"
elif [ -n "${{ github.base_ref }}" ]; then
ARGS="$ARGS --base=${{ github.base_ref }}"
fi
if [ -n "${{ github.sha }}" ]; then
ARGS="$ARGS --head=${{ github.sha }}"
fi
if [ -n "${{ inputs.files }}" ]; then
ARGS="$ARGS --files=${{ inputs.files }}"
fi
if [ -n "${{ inputs.stages }}" ]; then
ARGS="$ARGS --stages=${{ inputs.stages }}"
fi
node "${{ github.action_path }}/dist/cli.js" $ARGS
- name: Post GitHub Integration
if: always()
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
cd "$GITHUB_WORKSPACE"
node "${{ github.action_path }}/dist/cli.js" github-integration
- name: Upload QualOps Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: qualops-reports
path: .qualops/reports/
retention-days: 30
- name: Set Outputs
if: always()
shell: bash
run: |
cd "$GITHUB_WORKSPACE"
if [ -f ".qualops/reports/sessions/*/overall-report.json" ]; then
REPORT=$(ls -t .qualops/reports/sessions/*/overall-report.json | head -1)
TOTAL=$(jq -r '.totalIssues // 0' "$REPORT")
CRITICAL=$(jq -r '.issuesBySeverity.critical // 0' "$REPORT")
HIGH=$(jq -r '.issuesBySeverity.high // 0' "$REPORT")
echo "total-issues=$TOTAL" >> $GITHUB_OUTPUT
echo "critical-issues=$CRITICAL" >> $GITHUB_OUTPUT
echo "high-issues=$HIGH" >> $GITHUB_OUTPUT
fi
if [ -f ".qualops/reports/sessions/*/judge-decision.json" ]; then
JUDGE=$(ls -t .qualops/reports/sessions/*/judge-decision.json | head -1)
PASSED=$(jq -r '.passed // false' "$JUDGE")
echo "quality-passed=$PASSED" >> $GITHUB_OUTPUT
fi