Collect Environment Data #451
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: Collect Environment Data | |
| on: | |
| schedule: | |
| - cron: '0 */3 * * *' # Every 3 hours | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| collect-environment: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: scripts/package.json | |
| - name: Install dependencies | |
| run: npm install | |
| working-directory: scripts | |
| - name: Collect environment data | |
| env: | |
| SEOUL_API_KEY: ${{ secrets.SEOUL_API_KEY }} | |
| run: node collect-environment.js | |
| working-directory: scripts | |
| - name: Build latest.json | |
| run: node build-latest.js | |
| working-directory: scripts | |
| - name: Create pull request with data | |
| id: cpr | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7 | |
| with: | |
| commit-message: 'chore: collect environment data' | |
| branch: auto/collect-environment | |
| title: 'chore: collect environment data' | |
| body: 'Automated environment data collection.' | |
| add-paths: | | |
| data-static/** | |
| web/public/data/** | |
| - name: Enable auto-merge | |
| if: steps.cpr.outputs.pull-request-number | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | |
| run: gh pr merge "$PR_NUMBER" --auto --squash |