Refresh Voted Issues #45435
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
# Uses Github API to get a list of issues that have votes on and then | |
# save results into a json | |
name: Refresh Voted Issues | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '5/30 * * * *' | |
# run on demand too if needed | |
workflow_dispatch: | |
jobs: | |
voted_main: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo this is running in | |
- name: checkout this repo | |
uses: actions/checkout@v3 | |
# setup python, lets default to the latest version | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install PyGithub | |
# run the python script passing in the github token | |
- name: Run the python | |
run: | | |
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
python query_gh_voted_issues.py | |
# commit the changes oonly if the file has changed | |
- name: Commit the changes | |
run: | | |
git config --global user.name 'votebot' | |
git config --global user.email '[email protected]' | |
git add -A | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "Update the voted issues json" | |
git push origin main | |
fi |