Bump revengai SDK #25
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: Bump revengai SDK | |
| on: | |
| schedule: | |
| - cron: '0 9 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| BUMP_BRANCH: chore/auto-bump-revengai | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate a token | |
| id: generate-token | |
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 | |
| with: | |
| app-id: ${{ secrets.REVENG_APP_ID }} | |
| private-key: ${{ secrets.REVENG_APP_PRIVATE_KEY }} | |
| owner: ${{ github.repository_owner }} | |
| repositories: | | |
| plugin-binary-ninja | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: '3.14' | |
| - name: Install packaging | |
| run: pip install packaging | |
| - name: Inspect existing bump PR | |
| id: existing | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| run: | | |
| set -euo pipefail | |
| pr_num=$(gh pr list --state open --head "$BUMP_BRANCH" \ | |
| --json number --jq '.[0].number // empty') | |
| if [ -z "$pr_num" ]; then | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "human_commits=0" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Count non-bot commits. Commits with a null author (email not linked | |
| # to a GitHub user) are conservatively counted as human so we don't | |
| # clobber an in-flight fix. | |
| human=$(gh api "repos/${{ github.repository }}/pulls/$pr_num/commits" \ | |
| --jq '[.[] | select(.author == null or .author.type != "Bot")] | length') | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| echo "pr_num=$pr_num" >> "$GITHUB_OUTPUT" | |
| echo "human_commits=$human" >> "$GITHUB_OUTPUT" | |
| - name: Skip when open PR has human commits | |
| if: steps.existing.outputs.exists == 'true' && steps.existing.outputs.human_commits != '0' | |
| run: | | |
| echo "PR #${{ steps.existing.outputs.pr_num }} has human commits; leaving it alone." | |
| echo "ABORT=true" >> "$GITHUB_ENV" | |
| - name: Compute version bump | |
| if: env.ABORT != 'true' | |
| id: bump | |
| run: python .github/scripts/bump_revengai.py >> "$GITHUB_OUTPUT" | |
| - name: Already up to date | |
| if: env.ABORT != 'true' && steps.bump.outputs.changed != 'true' | |
| run: echo "revengai is already at ${{ steps.bump.outputs.current_sdk }}; nothing to do." | |
| - name: Open or update bump PR | |
| if: env.ABORT != 'true' && steps.bump.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| branch: ${{ env.BUMP_BRANCH }} | |
| base: main | |
| commit-message: "chore: bump revengai to ${{ steps.bump.outputs.new_sdk }}" | |
| title: "chore: bump revengai to ${{ steps.bump.outputs.new_sdk }}" | |
| body: | | |
| Auto-generated by `.github/workflows/bump-revengai-sdk.yaml`. | |
| **SDK:** `revengai` `${{ steps.bump.outputs.current_sdk }}` → `${{ steps.bump.outputs.new_sdk }}` | |
| - Release notes: https://github.com/RevEngAI/sdk-python/releases/tag/v${{ steps.bump.outputs.new_sdk }} | |
| - Changelog: https://github.com/RevEngAI/sdk-python/compare/v${{ steps.bump.outputs.current_sdk }}...v${{ steps.bump.outputs.new_sdk }} | |
| This is a rolling PR. | |
| Review for schema/breaking changes before merging. | |
| labels: | | |
| dependencies | |
| automated | |
| delete-branch: true |