Update BidSniffer Bids #8
This file contains hidden or 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: Update BidSniffer Bids | |
| on: | |
| schedule: | |
| - cron: '17 10 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: update-bids-main | |
| cancel-in-progress: true | |
| jobs: | |
| update-bids: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config pull.rebase true | |
| - name: Sync latest main | |
| run: git pull --rebase origin main | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Harvest opportunities | |
| run: npm run harvest | |
| - name: Generate static pages and sitemap | |
| run: npm run generate | |
| - name: Commit updated bid data and pages | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git add src/data/opportunities.json public/data/opportunities.json public/app.js public/styles.css public/index.html public/contractors public/bids public/sitemap.xml | |
| git commit -m "Update harvested bid opportunities" | |
| git push || (git pull --rebase origin main && git push) | |
| else | |
| echo "No BidSniffer changes to commit." | |
| fi |