-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
68 lines (67 loc) · 2.17 KB
/
action.yml
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
name: 'Smelly Python: Smell My PR'
description: 'Post a summary of pylint report as a comment on PRs.'
branding:
icon: 'message-square'
color: 'orange'
inputs:
command:
description: The command to run smelly-python.
required: true
default: pipenv run smelly-python -d src
github-token:
description: Github token
required: true
default: ''
install-pipenv:
description: Specify whether pipenv should still be installed
required: false
default: true
runs:
using: 'composite'
steps:
- name: Install pipenv
run: |
sudo apt-get update
sudo -H pip install -U pipenv
- name: Setup smelly-python
run: |
pip install smelly-python
pip install bs4
pip install pylint
# Generate report
- name: Generate report from smelly-python
shell: bash
run: ${{ inputs.command }}
- name: Save output folder with html report
if: always()
uses: actions/upload-artifact@v3
with:
name: smelly-python-html-report
path: |
${{ github.workspace }}/report/smelly_python/**/*
!${{ github.workspace }}/report/smelly_python/**/*.md
- name: Set job summary
if: always()
shell: bash
run: cat ${{ github.workspace }}/report/smelly_python/comment.md >> $GITHUB_STEP_SUMMARY
- name: Get PR number
if: always()
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: echo "pr_number=`gh pr view ${GITHUB_REF_NAME} --json number -q '.number'`" >> $GITHUB_ENV
- name: Delete old comments
if: ${{ always() && env.pr_number != '' }}
uses: maheshrayas/action-pr-comment-delete@v1
with:
github_token: ${{ inputs.github-token }}
org: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name}}
user: github-actions[bot] #commented by the userid
issue: ${{ env.pr_number }}
- name: Post comment
if: ${{ always() && env.pr_number != '' }}
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: gh pr comment ${GITHUB_REF_NAME} -F ${{ github.workspace }}/report/smelly_python/comment.md