Skip to content

Commit e1a6bcc

Browse files
authored
Merge pull request #38 from arthurpalves/action
Action
2 parents d5d656c + cecbf76 commit e1a6bcc

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/test_action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: test_action
2+
3+
on:
4+
push:
5+
branches: [ action ]
6+
env:
7+
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer
8+
GITHUB_TOKEN: ${{ secrets.PAT }}
9+
10+
jobs:
11+
build:
12+
runs-on: macos-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: arthurpalves/coherent-swift@0.5.5
18+
with:
19+
source: Sources/
20+
minimum_threshold: 60
21+
ignore_output_result: true
22+
only_changes: true
23+
report_format: plain
24+

action.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'coherent-swift'
2+
description: 'Measures cohesion in your Swift codebase'
3+
author: 'Arthur Alves <arthuralves.p@gmail.com>'
4+
branding:
5+
icon: "code"
6+
color: "green"
7+
8+
inputs:
9+
source:
10+
description: 'Source folder to scan.'
11+
required: true
12+
minimum_threshold:
13+
description: 'Overall cohesion will be validated against this minimum threshold.'
14+
required: true
15+
default: '80'
16+
reports_folder:
17+
description: 'The folder where your reports will be saved to.'
18+
required: true
19+
default: './coherent-swift-reports'
20+
ignore_output_result:
21+
description: 'If "true", measure in passive mode. Observe without enforcing changes'
22+
required: true
23+
default: 'false'
24+
report_format:
25+
description: 'Format of cohesion report. Available formats: json, plain'
26+
required: true
27+
default: 'json'
28+
only_changes:
29+
description: 'If "true", only measure cohesion on changed files.'
30+
required: true
31+
default: 'false'
32+
33+
runs:
34+
using: "composite"
35+
steps:
36+
- name: Prepare spec
37+
shell: bash
38+
run: |
39+
echo -e "source: ${{ inputs.source }}\n" > ${{ github.action_path }}/_coherent-swift.yml
40+
echo -e "minimum_threshold: ${{ inputs.minimum_threshold }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
41+
echo -e "reports_folder: ${{ inputs.reports_folder }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
42+
echo -e "ignore_output_result: ${{ inputs.ignore_output_result }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
43+
echo -e "report_format: ${{ inputs.report_format }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
44+
45+
- name: Measure cohesion
46+
shell: bash
47+
run: |
48+
cd ${{ github.action_path }}
49+
if [[ ${{ inputs.only_changes }} == 'true' ]]; then
50+
swift run coherent-swift report -d -s _coherent-swift.yml
51+
else
52+
swift run coherent-swift report -s _coherent-swift.yml
53+
fi

0 commit comments

Comments
 (0)