Skip to content

Commit 7b3d591

Browse files
authored
ci: read the service account token from repository environments (#1247)
Jobs using `APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN` now read it from the `pypi` or `github-pages` environment, and the changelog update and factory review use the `apify/actions` actions instead of the reusable workflows.
1 parent 2d325e5 commit 7b3d591

6 files changed

Lines changed: 69 additions & 28 deletions

‎.github/workflows/factory_review.yaml‎

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: apify-factory review (AI review, and auto-approval)
22

33
# Calls the apify-factory review and auto-approval pipeline (apify/ai-developer, wired up in
4-
# apify/workflows). A pull request is reviewed when apify-factory is requested; with the
4+
# apify/actions). A pull request is reviewed when apify-factory is requested; with the
55
# repository's `factory_auto_review` custom property set to true, also every ready pull request when
66
# it opens and after every push that changes its content. Approvals additionally need the
77
# repository's `factory_auto_approve` custom property set to true.
@@ -40,20 +40,34 @@ concurrency:
4040

4141
jobs:
4242
factory-review:
43-
uses: apify/workflows/.github/workflows/factory_review.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1
44-
# The three secrets the pipeline declares, instead of every secret this repository can read.
45-
secrets:
46-
APIFY_FACTORY_GITHUB_TOKEN: ${{ secrets.APIFY_FACTORY_GITHUB_TOKEN }}
47-
ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW: ${{ secrets.ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW }}
48-
APIFY_FACTORY_CALLBACK_TOKEN: ${{ secrets.APIFY_FACTORY_CALLBACK_TOKEN }}
49-
# Paths never auto-approved here, on top of the pipeline's defaults. Proposed from the
50-
# repository's layout when this workflow was added; edit them like any other code.
51-
with:
52-
policy: |
53-
{
54-
"denyGlobs": [
55-
"src/apify_client/_models.py",
56-
"src/apify_client/_typeddicts.py",
57-
"src/apify_client/_literals.py"
58-
]
59-
}
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 60
45+
permissions:
46+
contents: read
47+
pull-requests: write
48+
# Proves to the core Actor that this run hands a review to a sandbox.
49+
id-token: write
50+
# Never cancel a running review: the action posts nothing from a cancelled run, which would leave
51+
# the request pending with no review. GitHub keeps one waiting run per group and replaces it with
52+
# a newer one. The group differs from the workflow's own, which would otherwise wait on this job.
53+
concurrency:
54+
group: factory-review-job-${{ github.event.pull_request.number }}
55+
cancel-in-progress: false
56+
steps:
57+
- name: apify-factory review
58+
uses: apify/actions/factory-review@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0
59+
with:
60+
apify-factory-github-token: ${{ secrets.APIFY_FACTORY_GITHUB_TOKEN }}
61+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY_APIFY_FACTORY_REVIEW }}
62+
apify-factory-callback-token: ${{ secrets.APIFY_FACTORY_CALLBACK_TOKEN }}
63+
factory-public-url: ${{ vars.FACTORY_PUBLIC_URL }}
64+
# Paths never auto-approved here, on top of the pipeline's defaults. Proposed from the
65+
# repository's layout when this workflow was added; edit them like any other code.
66+
policy: |
67+
{
68+
"denyGlobs": [
69+
"src/apify_client/_models.py",
70+
"src/apify_client/_typeddicts.py",
71+
"src/apify_client/_literals.py"
72+
]
73+
}

‎.github/workflows/manual_release_beta.yaml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,22 @@ jobs:
4444
changelog_update:
4545
name: Changelog update
4646
needs: [release_prepare]
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: pypi
50+
deployment: false
4751
permissions:
4852
contents: write
49-
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1
50-
with:
51-
version_number: ${{ needs.release_prepare.outputs.version_number }}
52-
changelog: ${{ needs.release_prepare.outputs.changelog }}
53-
secrets: inherit
53+
outputs:
54+
changelog_commitish: ${{ steps.changelog_update.outputs.changelog-commitish }}
55+
steps:
56+
- name: Bump version and update changelog
57+
id: changelog_update
58+
uses: apify/actions/python-bump-and-update-changelog@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0
59+
with:
60+
version-number: ${{ needs.release_prepare.outputs.version_number }}
61+
changelog: ${{ needs.release_prepare.outputs.changelog }}
62+
apify-service-account-github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
5463

5564
# Publishing runs as a separate workflow run of `publish_to_pypi.yaml` (see the comment there).
5665
pypi_publish:

‎.github/workflows/manual_release_docs.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ jobs:
131131
permissions:
132132
contents: read
133133
runs-on: ubuntu-latest
134+
environment:
135+
name: github-pages
136+
deployment: false
134137

135138
steps:
136139
- name: Checkout repository

‎.github/workflows/manual_release_stable.yaml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,22 @@ jobs:
6363
changelog_update:
6464
name: Changelog update
6565
needs: [release_prepare]
66+
runs-on: ubuntu-latest
67+
environment:
68+
name: pypi
69+
deployment: false
6670
permissions:
6771
contents: write
68-
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@0a1eaf3d3b67be2e8c15b2fc989168721809c8e2 # v1.4.1
69-
with:
70-
version_number: ${{ needs.release_prepare.outputs.version_number }}
71-
changelog: ${{ needs.release_prepare.outputs.changelog }}
72-
secrets: inherit
72+
outputs:
73+
changelog_commitish: ${{ steps.changelog_update.outputs.changelog-commitish }}
74+
steps:
75+
- name: Bump version and update changelog
76+
id: changelog_update
77+
uses: apify/actions/python-bump-and-update-changelog@994a3e5ec79a5575ac4d81365bab7549c9687c32 # v1.9.0
78+
with:
79+
version-number: ${{ needs.release_prepare.outputs.version_number }}
80+
changelog: ${{ needs.release_prepare.outputs.changelog }}
81+
apify-service-account-github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
7382

7483
github_release:
7584
name: GitHub release

‎.github/workflows/manual_version_docs.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ jobs:
146146
name: Commit versioned docs
147147
needs: [version_docs]
148148
runs-on: ubuntu-latest
149+
environment:
150+
name: pypi
151+
deployment: false
149152
permissions:
150153
contents: read
151154

‎.github/workflows/on_schedule_regenerate_models.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
regenerate-models:
3737
name: Regenerate models
3838
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
deployment: false
3942

4043
steps:
4144
- name: Checkout master

0 commit comments

Comments
 (0)