fix: [#72] Create github pr labels if they do not exist yet #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: python | |
"on": push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: testing | |
run: | | |
echo helloworld | |
gh label list --json name |\ | |
jq -r '.[] | select(.name=="documentation") | .name' | |
check_label_exists() { | |
local label_name="$1" | |
LABEL_EXISTS=$( | |
gh label list --json name | | |
jq -r ' | |
.[] | | |
select(.name == "'"$label_name"'") | | |
.name | |
' | |
) | |
if [ -z "$LABEL_EXISTS" ]; then | |
echo "label: '${label_name}' does NOT exist" | |
return 1 | |
fi | |
} | |
dependenciesLabel=dependencies | |
if ! check_label_exists ${dependenciesLabel}; then | |
gh label create ${dependenciesLabel} \ | |
--color "#0366d6" \ | |
--description "Pull requests that update a dependency file" | |
fi | |
goLabel=go | |
if ! check_label_exists ${goLabel}; then | |
gh label create ${goLabel} \ | |
--color "#16e2e2" \ | |
--description "Pull requests that update Go code" | |
fi | |
goModUpdaterLabel=gomod-go-version-updater | |
if ! check_label_exists ${goModUpdaterLabel}; then | |
gh label create ${goModUpdaterLabel} \ | |
--color "#F50BAB" \ | |
--description "Pull requests that update Go version in the go.mod file" | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- uses: actions/[email protected] | |
with: | |
python-version: 3.9.18 | |
cache: "pip" | |
- name: Install PIP packages defined in requirements.txt | |
run: | | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
pytest --cov=main test.py --verbose --capture=no --cov-report term-missing |