Fetch and Update Issues #1843
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: Fetch and Update Issues | |
on: | |
schedule: | |
- cron: "0 */2 * * *" # every 2 hours | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write | |
issues: read | |
jobs: | |
fetch-and-save-issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: true | |
ref: master | |
fetch-depth: 0 | |
token: ${{ secrets.SFIGS_TOKEN }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: npm install | |
- name: Compile TypeScript to JavaScript | |
run: npm run compile:scripts | |
- name: Fetch Issues from GitHub and Update Files | |
env: | |
SFIGS_TOKEN: ${{ secrets.SFIGS_TOKEN }} | |
run: npm run fetch-issues | |
- name: Commit and Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.SFIGS_TOKEN }} | |
run: | | |
git config --global user.email "${{secrets.EMAIL}}" | |
git config --global user.name "${{secrets.NAME}}" | |
git add -f public/open-source-projects/issues/ | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update open source project issues" && git push) |