Daily API Tracker #142
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: Daily API Tracker | |
| on: | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: # Allow manual trigger for testing | |
| permissions: | |
| issues: write | |
| contents: read | |
| jobs: | |
| track-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '24' | |
| distribution: 'temurin' | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build and test project | |
| run: mvn clean install | |
| - name: Run API Tracker | |
| run: | | |
| mvn exec:java \ | |
| -pl json-java21-api-tracker \ | |
| -Dexec.mainClass="io.github.simbo1905.tracker.ApiTrackerRunner" \ | |
| -Dexec.args="INFO" \ | |
| -Djava.util.logging.ConsoleHandler.level=INFO | |
| - name: Create issue if differences found | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = 'API differences detected between local and upstream'; | |
| const body = `The daily API tracker found differences between our local implementation and upstream. | |
| Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. | |
| Date: ${new Date().toISOString().split('T')[0]}`; | |
| github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: ['api-tracking', 'upstream-sync'] | |
| }); |