From e696c3c383c184e05ce445ff7e3fc44b3bbd62bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Fri, 20 Nov 2026 10:02:57 +0100 Subject: [PATCH] ci: read the service account token from repository environments --- .github/workflows/factory_review.yaml | 50 ++++++++++++------- .github/workflows/manual_release_beta.yaml | 19 +++++-- .github/workflows/manual_release_docs.yaml | 3 ++ .github/workflows/manual_release_stable.yaml | 19 +++++-- .github/workflows/manual_version_docs.yaml | 3 ++ .../on_schedule_regenerate_models.yaml | 3 ++ 6 files changed, 69 insertions(+), 28 deletions(-) diff --git a/.github/workflows/factory_review.yaml b/.github/workflows/factory_review.yaml index 2e9d4b23..ec7241fa 100644 --- a/.github/workflows/factory_review.yaml +++ b/.github/workflows/factory_review.yaml @@ -1,7 +1,7 @@ name: apify-factory review (AI review, and auto-approval) # Calls the apify-factory review and auto-approval pipeline (apify/ai-developer, wired up in -# apify/workflows). A pull request is reviewed when apify-factory is requested; with the +# apify/actions). A pull request is reviewed when apify-factory is requested; with the # repository's `factory_auto_review` custom property set to true, also every ready pull request when # it opens and after every push that changes its content. Approvals additionally need the # repository's `factory_auto_approve` custom property set to true. @@ -40,20 +40,34 @@ concurrency: jobs: factory-review: - uses: apify/workflows/.github/workflows/factory_review.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1 - # The three secrets the pipeline declares, instead of every secret this repository can read. - secrets: - APIFY_FACTORY_GITHUB_TOKEN: ${{ secrets.APIFY_FACTORY_GITHUB_TOKEN }} - ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW: ${{ secrets.ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW }} - APIFY_FACTORY_CALLBACK_TOKEN: ${{ secrets.APIFY_FACTORY_CALLBACK_TOKEN }} - # Paths never auto-approved here, on top of the pipeline's defaults. Proposed from the - # repository's layout when this workflow was added; edit them like any other code. - with: - policy: | - { - "denyGlobs": [ - "src/apify_client/_models.py", - "src/apify_client/_typeddicts.py", - "src/apify_client/_literals.py" - ] - } + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: read + pull-requests: write + # Proves to the core Actor that this run hands a review to a sandbox. + id-token: write + # Never cancel a running review: the action posts nothing from a cancelled run, which would leave + # the request pending with no review. GitHub keeps one waiting run per group and replaces it with + # a newer one. The group differs from the workflow's own, which would otherwise wait on this job. + concurrency: + group: factory-review-job-${{ github.event.pull_request.number }} + cancel-in-progress: false + steps: + - name: apify-factory review + uses: apify/actions/factory-review@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0 + with: + apify-factory-github-token: ${{ secrets.APIFY_FACTORY_GITHUB_TOKEN }} + anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW }} + apify-factory-callback-token: ${{ secrets.APIFY_FACTORY_CALLBACK_TOKEN }} + factory-public-url: ${{ vars.FACTORY_PUBLIC_URL }} + # Paths never auto-approved here, on top of the pipeline's defaults. Proposed from the + # repository's layout when this workflow was added; edit them like any other code. + policy: | + { + "denyGlobs": [ + "src/apify_client/_models.py", + "src/apify_client/_typeddicts.py", + "src/apify_client/_literals.py" + ] + } diff --git a/.github/workflows/manual_release_beta.yaml b/.github/workflows/manual_release_beta.yaml index 36447637..f830a79a 100644 --- a/.github/workflows/manual_release_beta.yaml +++ b/.github/workflows/manual_release_beta.yaml @@ -44,13 +44,22 @@ jobs: changelog_update: name: Changelog update needs: [release_prepare] + runs-on: ubuntu-latest + environment: + name: pypi + deployment: false permissions: contents: write - uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1 - with: - version_number: ${{ needs.release_prepare.outputs.version_number }} - changelog: ${{ needs.release_prepare.outputs.changelog }} - secrets: inherit + outputs: + changelog_commitish: ${{ steps.changelog_update.outputs.changelog-commitish }} + steps: + - name: Bump version and update changelog + id: changelog_update + uses: apify/actions/python-bump-and-update-changelog@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0 + with: + version-number: ${{ needs.release_prepare.outputs.version_number }} + changelog: ${{ needs.release_prepare.outputs.changelog }} + apify-service-account-github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} # Publishing runs as a separate workflow run of `publish_to_pypi.yaml` (see the comment there). pypi_publish: diff --git a/.github/workflows/manual_release_docs.yaml b/.github/workflows/manual_release_docs.yaml index 27d554f6..a61215e8 100644 --- a/.github/workflows/manual_release_docs.yaml +++ b/.github/workflows/manual_release_docs.yaml @@ -131,6 +131,9 @@ jobs: permissions: contents: read runs-on: ubuntu-latest + environment: + name: github-pages + deployment: false steps: - name: Checkout repository diff --git a/.github/workflows/manual_release_stable.yaml b/.github/workflows/manual_release_stable.yaml index a3b6508f..86ce77b7 100644 --- a/.github/workflows/manual_release_stable.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -63,13 +63,22 @@ jobs: changelog_update: name: Changelog update needs: [release_prepare] + runs-on: ubuntu-latest + environment: + name: pypi + deployment: false permissions: contents: write - uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1 - with: - version_number: ${{ needs.release_prepare.outputs.version_number }} - changelog: ${{ needs.release_prepare.outputs.changelog }} - secrets: inherit + outputs: + changelog_commitish: ${{ steps.changelog_update.outputs.changelog-commitish }} + steps: + - name: Bump version and update changelog + id: changelog_update + uses: apify/actions/python-bump-and-update-changelog@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0 + with: + version-number: ${{ needs.release_prepare.outputs.version_number }} + changelog: ${{ needs.release_prepare.outputs.changelog }} + apify-service-account-github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} github_release: name: GitHub release diff --git a/.github/workflows/manual_version_docs.yaml b/.github/workflows/manual_version_docs.yaml index 46715bba..5b7aedaa 100644 --- a/.github/workflows/manual_version_docs.yaml +++ b/.github/workflows/manual_version_docs.yaml @@ -146,6 +146,9 @@ jobs: name: Commit versioned docs needs: [version_docs] runs-on: ubuntu-latest + environment: + name: pypi + deployment: false permissions: contents: read diff --git a/.github/workflows/on_schedule_regenerate_models.yaml b/.github/workflows/on_schedule_regenerate_models.yaml index 9fe169ed..8482b3fe 100644 --- a/.github/workflows/on_schedule_regenerate_models.yaml +++ b/.github/workflows/on_schedule_regenerate_models.yaml @@ -36,6 +36,9 @@ jobs: regenerate-models: name: Regenerate models runs-on: ubuntu-latest + environment: + name: pypi + deployment: false steps: - name: Checkout master