Skip to content

Refresh Voted Issues #38983

Refresh Voted Issues

Refresh Voted Issues #38983

# 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 'noreply@github.com'
git add -A
if ! git diff-index --quiet HEAD; then
git commit -m "Update the voted issues json"
git push origin main
fi