GeonicDB compatibility check #9
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: GeonicDB compatibility check | |
| on: | |
| schedule: | |
| - cron: "0 9 * * 1" # 毎週月曜 09:00 UTC | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.GH_APP_ID }} | |
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
| owner: geolonia | |
| repositories: geonicdb | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Configure git for private repos | |
| run: | | |
| git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "https://github.com/" | |
| git config --global --add url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "ssh://git@github.com/" | |
| git config --global --add url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "git@github.com:" | |
| - name: Update geonicdb to latest | |
| run: | | |
| node -e " | |
| const p = require('./package.json'); | |
| p.devDependencies.geonicdb = 'github:geolonia/geonicdb'; | |
| require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n'); | |
| " | |
| npm install | |
| - name: Show updated version | |
| run: npm ls geonicdb | |
| - run: npm run lint | |
| - run: npm run typecheck | |
| - run: npm test | |
| - run: npm run test:e2e | |
| - name: Create issue on failure | |
| if: failure() | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| GEONICDB_VERSION=$(npm ls geonicdb --json 2>/dev/null | node -e " | |
| const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')); | |
| const dep = d.dependencies?.geonicdb; | |
| console.log(dep?.version ?? 'unknown'); | |
| ") | |
| gh issue create \ | |
| --title "geonicdb 最新版 (${GEONICDB_VERSION}) との互換性エラー" \ | |
| --body "$(cat <<EOF | |
| ## 概要 | |
| 週次の互換性チェックで、geonicdb の最新版でテストが失敗しました。 | |
| - **geonicdb version**: ${GEONICDB_VERSION} | |
| - **Workflow run**: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} | |
| ## 対応 | |
| 1. Workflow run のログを確認し、破壊的変更の内容を特定 | |
| 2. CLI 側のコードを修正 | |
| 3. `package.json` の geonicdb コミットハッシュを最新に更新 | |
| EOF | |
| )" |