Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .factory/review-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"denyGlobs": [
"src/lib/credentials.ts",
"src/lib/auth-file.ts",
"src/lib/oauth/**",
"scripts/install/**",
"skills/**",
"patches/**"
]
}
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
/docs/*.md @szaganek
/docs/*.mdx @szaganek
/docs/changelog.md @szaganek
/.github/workflows/factory_review.yaml @mtrunkat
70 changes: 21 additions & 49 deletions .github/workflows/factory_review.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: apify-factory review (AI review, and auto-approval)
name: apify-factory review

# Calls the apify-factory review and auto-approval pipeline (apify/ai-developer, wired up in
# 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.
# Tells the apify-factory review pipeline (apify/ai-developer) about each pull request event: the
# factory reviews the pull request when apify-factory is requested, and, with the repository's
# `factory_auto_review` custom property set to true, every ready pull request when it opens and after
# every push that changes its content. This workflow withdraws the bot's approval whenever the
# factory says so or gives no answer. It holds no secret: its OIDC token proves which run asks.
# Approvals also need the `factory_auto_approve` custom property set to true; this repository's own
# review rules live in `.factory/review-policy.json` on the default branch.
on:
# Taken from the default branch, never from the pull request, so a pull request cannot rewrite
# its own review pipeline. Pull request code is never checked out or executed. `edited` delivers
# base changes, without which pull requests on another base are not approved.
# its own guard. Pull request code is never checked out or executed. `edited` delivers base
# changes, without which pull requests on another base are not approved.
pull_request_target:
types:
- opened
Expand All @@ -21,56 +23,26 @@ on:
- edited

permissions:
contents: read
pull-requests: write
# Proves to the core Actor that this run hands a review to a sandbox.
id-token: write

# A push cancels the run in progress, and only the newest waiting run is kept, so an event that
# starts no job (a request or removal naming another reviewer) gets its own group, as does
# removing the bot's request. Never name a group `factory-review-<number>` alone: it deadlocks.
# A push cancels the run in progress, since the newer run judges the pull request as it now
# stands. The events the guard passes over (a request or removal naming another reviewer, an edit
# that keeps the base) and the bot's request being removed get groups of their own, so that none
# of them takes the place of a waiting run that matters.
concurrency:
group: >-
factory-review-${{ github.event.pull_request.number }}-${{
startsWith(github.event.action, 'review_request')
&& github.event.requested_reviewer.login != 'apify-factory' && github.run_id
factory-review-guard-${{ github.event.pull_request.number }}-${{
(startsWith(github.event.action, 'review_request')
&& github.event.requested_reviewer.login != 'apify-factory'
|| github.event.action == 'edited' && !github.event.changes.base) && github.run_id
|| github.event.action == 'review_request_removed' && 'withdraw'
|| 'events' }}
cancel-in-progress: ${{ github.event.action == 'synchronize' }}

jobs:
factory-review:
guard:
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
timeout-minutes: 10
steps:
- name: apify-factory review
uses: apify/actions/factory-review@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/lib/credentials.ts",
"src/lib/auth-file.ts",
"src/lib/oauth/**",
"scripts/install/**",
"skills/**",
"patches/**"
]
}
- uses: apify/actions/factory-review@62f09e2456d6bfab33891dc37a604c67aeb98298 # v1.10.0
Loading