-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
61 lines (58 loc) · 1.92 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
name: Weather - Profile README
author: bumb7ebee
description: Update your README.md file with the weather of a city
branding:
color: yellow
icon: cloud-rain
inputs:
weather-api-key:
description: "OpenWeather API key"
required: true
city-id:
description: "City ID obtained from OpenWeather"
required: true
units:
description: "Centigrade (c) or Fahrenheit (f)"
required: false
default: 'c'
country-code:
description: "Country code obtained from https://flagicons.lipis.dev/"
required: true
readme-path:
description: "README.md file path"
required: false
default: 'README.md'
runs:
using: 'composite'
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: 'x64'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r ${{ github.action_path }}/src/requirements.txt
- name: Pass inputs to shell
shell: bash
run: |
echo "INPUT_WEATHER_API_KEY=${{ inputs.weather-api-key }}" >> $GITHUB_ENV
echo "INPUT_CITY_ID=${{ inputs.city-id }}" >> $GITHUB_ENV
echo "INPUT_UNITS=${{ inputs.units }}" >> $GITHUB_ENV
echo "INPUT_COUNTRY=${{ inputs.country }}" >> $GITHUB_ENV
echo "INPUT_COUNTRY_CODE=${{ inputs.country-code }}" >> $GITHUB_ENV
printf "README_PATH=%s/%s\n" $GITHUB_WORKSPACE ${{ inputs.readme-path }} >> $GITHUB_ENV
- name: Run script
shell: bash
run: |
python -u ${{ github.action_path }}/src/main.py
- name: Push changes
shell: bash
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ${{ inputs.readme-path }}
git commit -m "☔ Update README.md with the recent weather" --allow-empty
git push origin main