-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
138 lines (138 loc) · 4.36 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 'pip-rating'
description: |
Run pip-rating on the project to get the requirements rating based on criteria like freshness,
popularity, maintenance, etc.
author: Nekmo
inputs:
file:
description: |
Path to the requirements file.
required: false
format:
description: |
Output format. Available formats: text, tree, json, only-rating & badge.
required: false
default: 'text'
file_type:
description: |
Requirements file type. By default this is autodetected. Available types: requirements, setup.cfg, setup.py,
Pipfile & pyproject.toml
required: false
default: ''
ignore_packages:
description: |
Packages to ignore separated by spaces.
required: false
default: ''
create_badge:
description: |
Create a badge image with the rating.
required: false
default: false
badge_path:
description: |
Path to save the badge image.
required: false
default: 'pip-rating-badge.svg'
badge_branch:
description: |
Branch to push the badge image.
required: false
default: ''
badge_style:
description: |
Badge style. Available styles: flat, flat-square & for-the-badge.
required: false
default: 'flat'
badge_s_color:
description: |
Badge color for S rating.
required: false
default: ''
badge_a_color:
description: |
Badge color for A rating.
required: false
default: ''
badge_b_color:
description: |
Badge color for B rating.
required: false
default: ''
badge_c_color:
description: |
Badge color for C rating.
required: false
default: ''
badge_d_color:
description: |
Badge color for D rating.
required: false
default: ''
badge_e_color:
description: |
Badge color for E rating.
required: false
default: ''
badge_f_color:
description: |
Badge color for F rating.
required: false
default: ''
runs:
using: 'composite'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install pip-rating
run: |
pip install "$GITHUB_ACTION_PATH"
shell: bash
- name: Run pip-rating
run: |
badge_path="${{ inputs.badge_path }}"
if [[ "${{ inputs.create_badge }}" == "false" ]]; then badge_path="" ; fi
python "$GITHUB_ACTION_PATH/_action.py" \
--file "${{ inputs.file }}" \
--format "${{ inputs.format }}" \
--file-type "${{ inputs.file_type }}" \
--badge-path "$badge_path"
env:
PIP_RATING_IGNORE_PACKAGES: ${{ inputs.ignore_packages }}
PIP_RATING_BADGE_STYLE: ${{ inputs.badge_style }}
PIP_RATING_BADGE_S_COLOR: ${{ inputs.badge_s_color }}
PIP_RATING_BADGE_A_COLOR: ${{ inputs.badge_a_color }}
PIP_RATING_BADGE_B_COLOR: ${{ inputs.badge_b_color }}
PIP_RATING_BADGE_C_COLOR: ${{ inputs.badge_c_color }}
PIP_RATING_BADGE_D_COLOR: ${{ inputs.badge_d_color }}
PIP_RATING_BADGE_E_COLOR: ${{ inputs.badge_e_color }}
PIP_RATING_BADGE_F_COLOR: ${{ inputs.badge_f_color }}
shell: bash
- name: Submit rating badge to the current branch
if: ${{ (inputs.create_badge != 'false') && (inputs.badge_branch == '') }}
run: |
echo "Updating badge at current branch"
git config --global user.name 'Pip-rating'
git config --global user.email '[email protected]'
git add "${{ inputs.badge_path }}"
git commit -am "Updated badge at $(date)" || echo "Already updated"
git push --force
shell: bash
- name: Submit rating badge to the badge branch
if: ${{ (inputs.create_badge != 'false') && (inputs.badge_branch != '') }}
run: |
echo "Updating badge at branch ${{ inputs.badge_branch }}"
mkdir /tmp/pip-rating-badge
mv "${{ inputs.badge_path }}" /tmp/pip-rating-badge
cp -r .git /tmp/pip-rating-badge
cd /tmp/pip-rating-badge
git config --global user.name 'Pip-rating'
git config --global user.email '[email protected]'
git checkout --orphan "${{ inputs.badge_branch }}"
git add "${{ inputs.badge_path }}"
git commit -am "Updated badge at $(date)" || echo "Already updated"
git push --force origin HEAD:"${{ inputs.badge_branch }}"
shell: bash