Auto-update ABI JSON file #32111
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: Auto-update ABI JSON file | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 15-23,0-3 * * 1-5' | |
| permissions: {} | |
| jobs: | |
| autoupdate: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| branch: | |
| - main | |
| - 3-x-y | |
| runs-on: ubuntu-latest | |
| environment: auto-updater | |
| permissions: | |
| id-token: write # for secret service access | |
| steps: | |
| - name: Generate GitHub App token (updater app) | |
| uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 | |
| id: generate-token | |
| with: | |
| creds: ${{ secrets.GH_APP_CREDS }} | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - run: yarn install --immutable | |
| - name: Update ABI registry | |
| run: | | |
| npm run update-abi-registry | |
| git add abi_registry.json | |
| - name: Commit Changes to ABI registry | |
| id: commit-changes | |
| uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0 | |
| with: | |
| fail-on-no-changes: false | |
| message: 'feat: update ABI registry' | |
| ref: "feat/update-abi-registry-${{ matrix.branch }}-${{ hashFiles('abi_registry.json') }}" | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Create pull request | |
| if: ${{ steps.commit-changes.outputs.sha }} | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| run: | | |
| gh pr create \ | |
| --title "feat: update ABI registry (${{ matrix.branch }})" \ | |
| --body "Automated PR to update abi_registry.json" \ | |
| --head "feat/update-abi-registry-${{ matrix.branch }}-${{ hashFiles('abi_registry.json') }}" \ | |
| --base ${{ matrix.branch }} | |
| - name: Get GitHub App token (approver app) | |
| if: ${{ steps.commit-changes.outputs.sha }} | |
| id: secret-service | |
| uses: electron/secret-service-action@3476425e8b30555aac15b1b7096938e254b0e155 # v1.0.0 | |
| - name: Approve and merge pull request | |
| if: ${{ steps.commit-changes.outputs.sha }} | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ fromJSON(steps.secret-service.outputs.secrets || '{}').PR_APPROVER_GH_TOKEN }} | |
| run: | | |
| set -eo pipefail | |
| gh pr review "feat/update-abi-registry-${{ matrix.branch }}-${{ hashFiles('abi_registry.json') }}" --approve | |
| sleep 30 # Checks don't always start immediately | |
| gh pr checks "feat/update-abi-registry-${{ matrix.branch }}-${{ hashFiles('abi_registry.json') }}" --watch --fail-fast | |
| gh pr merge "feat/update-abi-registry-${{ matrix.branch }}-${{ hashFiles('abi_registry.json') }}" --squash |