Updates your README.md file with the weather of a city
πΏ DEMO
Caution
This repo is in preview release. It may contain bugs. Please open an issue for any feedback. Thanks for your understanding.
- Star this repo π
- Obtain an API key from OpenWeather
- Go to your repository
- Go to your repository's
Settings
- Add a new repository secret named
WEATHER_API_KEY
containing your API key forActions
inSecrets and variables
- Add the following section to your README.md file. The workflow will replace this comment with the weather:
<!-- WEATHER:START -->
<!-- WEATHER:END -->
- Create a folder named
.github
and create aworkflows
folder inside it, if it doesn't exist. - Create a new file named
weather-profile-workflow.yml
with the following contents inside the workflows folder:
name: Update Weather
on:
schedule: # run workflow automatically
- cron: '0 */3 * * *' # runs every three hours
# allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write # to write the generated contents to the README
jobs:
build:
name: Update this repo's README with recent weather
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pull in weather data
uses: bumb7ebee/weather-profile-actions@v1
with:
weather-api-key: ${{ secrets.WEATHER_API_KEY }} # secret variable of OpenWeather API KEY
city-id: 740483 # city id obtained from OpenWeather
units: c # c (centigrade) or f (fahrenheit)
country-code: tr # country code obtained from https://flagicons.lipis.dev/
readme-path: README.md # relative path of the README file. something like: README, README.md, src/README, src/README.md, etc.
- Wait for it to run automatically, or you can also trigger it manually to see the result instantly.
This workflow has options that you can use to customize it for your use case. The following are the list of options available:
Option | Default Value | Required | Description |
---|---|---|---|
weather-api-key |
"" |
Yes | Secret variable of OpenWeather API KEY |
city-id |
"" |
Yes | City ID obtained from OpenWeather |
units |
"" |
Yes | c (centigrade) or f (fahrenheit) |
country-code |
"" |
Yes | Country code obtained from https://flagicons.lipis.dev/ |
readme-path |
"" |
Yes | Relative path of the README file. Something like: README, README.md, src/README, src/README.md, etc. |
I had the idea of creating an actions for learning purposes for a while. When I took a quick look at the actions in Marketplace, I saw that almost all actions are trying to be written in web frameworks like Nodejs or React. I am a system programmer; I don't know web frameworks like Node.js or React. Sometimes I use Python language for scripting purposes to automate my daily work. So I pursued the idea of how an action could be written with Python. I am not a Python guru or pro. I am open to any kind of contribution, and I would appreciate your contributions.
Contributions are welcome! Feel free to open an issue or submit a pull request if you want to improve this project πͺπͺπͺ
Please make sure your request is meaningful and you have tested the app locally before submitting a pull request π
π If you like this project, give it a β and share it with friends!
https://github.com/thmsgbrt/thmsgbrt
https://github.com/huantt/weather-forecast
This product is licensed under the MIT License.
Weather - Profile README is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.