-
Notifications
You must be signed in to change notification settings - Fork 582
ci(website): preview skips Dependabot PRs and fires on ready_for_review #5454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+5
−2
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 20161
🌐 Web query:
GitHub Actions github.actor pull_request user login context dependabot workflow_dispatch💡 Result:
In GitHub Actions, the context variables
github.actorandgithub.triggering_actorserve different purposes, and their behavior with Dependabot and manual triggers has critical security and workflow implications [1][2]. github.actor This represents the user or app that triggered the workflow run [1][2]. For Dependabot, this value is 'dependabot[bot]' when the workflow is initially triggered by a Dependabot-opened PR or event [3]. It is important to note thatgithub.actoris not always the author of the pull request; it is the entity that caused the most recent event to trigger the workflow [4][3]. If a human pushes a commit to a Dependabot-authored PR,github.actorwill reflect that human user instead of 'dependabot[bot]' [3]. github.triggering_actor This represents the user who initiated the workflow run [1][2]. This is particularly relevant for re-runs: if a user manually re-runs a workflow,github.triggering_actorwill be that user, whilegithub.actorremains the entity that triggered the initial run [1][5]. Workflow privileges (such as secrets and permissions) are consistently determined by the originalgithub.actorto maintain security stability during re-runs [1][5]. Dependabot and Security Context Workflows triggered by Dependabot are often treated as if they originate from a repository fork [6][7]. This imposes security restrictions by default: - Read-only GITHUB_TOKEN permissions [6][7]. - Absence of standard GitHub Actions secrets (only Dependabot secrets are available) [6][7]. - Bypassing some repository-level policy checks [8]. Usingif: github.actor == 'dependabot[bot]'as a sole trust boundary is considered unsafe because it does not verify the actual author of the pull request [4]. To securely gate workflows or differentiate behavior, it is recommended to verify the PR author usinggithub.event.pull_request.user.login == 'dependabot[bot]'in conjunction with other checks (e.g., repository ownership) [9][4]. workflow_dispatch When a workflow is triggered manually viaworkflow_dispatch, thegithub.actoris the user who clicked the button or triggered the event via API [1][10]. Theinputscontext is only available when a workflow is triggered byworkflow_dispatchor is a reusable workflow [1]. Re-running aworkflow_dispatchevent will retain the original triggering context's privileges [1][5].Citations:
bot-conditionsfalse positive whengithub.actoris used only to suppress follow-up bot reruns zizmorcore/zizmor#1914🌐 Web query:
GitHub Actions triggers a workflow by Dependabot pull_request branch protection merge commit github.actor changing💡 Result:
When GitHub Actions workflows are triggered by Dependabot, they are subject to specific security restrictions because Dependabot is treated as an external actor (similar to a pull request from a fork) [1][2][3]. Key behaviors and constraints for Dependabot-triggered workflows include: 1. Token Permissions: By default, workflows triggered by Dependabot via
pull_requestorpushevents receive a read-only GITHUB_TOKEN [1][3]. While you can elevate these permissions using thepermissionskey in your workflow file, this is often insufficient if the workflow also requires access to secrets [2][4]. 2. Secrets Access: Workflows triggered by Dependabot cannot access standard GitHub Actions secrets [1][2]. They only have access to Dependabot-specific secrets configured in your repository settings [1][5][3]. If your workflow requires access to repository or organization-level secrets (such as a personal access token for merging), these must be added as Dependabot secrets [1][5]. 3. Event Triggers: -pull_request: Workflows use a read-only token and have limited access to secrets [1][2][3]. -pull_request_target: This event runs in the context of the base branch and is commonly used for automation tasks like auto-merging or labeling because it provides the write permissions and access to secrets needed to perform these actions [6][7]. However, note that if the base reference of the pull request was also created by Dependabot, evenpull_request_targetworkflows may face the same read-only and no-secrets limitations [3]. 4. Identifying the Actor: You can explicitly identify if a workflow was triggered by Dependabot using the conditionalif: github.actor == 'dependabot[bot]'[1][3][7]. Conversely, you can exclude Dependabot from specific workflows usingif: github.actor != 'dependabot[bot]'[1][2]. For common tasks like auto-merging Dependabot pull requests that must respect branch protection rules, the standard approach is to use apull_request_targetworkflow, ensure that necessary tokens (like a PAT) are stored as Dependabot secrets, and confirm that the repository settings allow auto-merge [8][6][5][7].Citations:
🌐 Web query:
site:github.blog.com changelog "dependabot" "github.actor" "human push"💡 Result:
Closest matches on the GitHub Changelog are:
push,pull_request, etc. are treated more like forked PRs for security. (github.blog)I didn’t find an exact changelog entry matching the full query text
"github.actor" "human push". If you want, I can dig for the specific post about distinguishing Dependabot from human pushes in Actions.Citations:
🌐 Web query:
GitHub Actions github.actor pull_request triggered by Dependabot branch protection merge commit💡 Result:
In GitHub Actions, relying on github.actor to identify Dependabot for critical tasks like auto-merging pull requests is an anti-pattern that can lead to "Confused Deputy" security vulnerabilities [1][2]. The github.actor context refers to the user or bot that triggered the workflow run, not the author of the pull request [3][2]. Because github.actor reflects the last actor to interact with the repository in a way that triggers an event (e.g., pushing a commit or commenting on a PR), an attacker can manipulate this value [2][4]. For example, if a workflow is triggered by an event on a pull request, an attacker could force a synchronize event or comment on a PR to make github.actor appear as dependabot[bot] even if the PR content was modified by someone else [2][4]. To securely identify if a pull request was created by Dependabot, you should use the immutable PR metadata instead [3][4]. Specifically, check the pull request author using the following condition: if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} This check is resistant to spoofing because it relies on the original creator of the pull request rather than the actor who most recently triggered the workflow [3][4]. Additionally, when working with Dependabot-triggered workflows: 1. Permissions: Workflows triggered by Dependabot on events like pull_request have read-only GITHUB_TOKEN permissions by default [5][6]. You must explicitly increase these permissions using the permissions key if the workflow needs to perform actions like merging [5][7]. 2. Secrets: Standard GitHub Actions secrets are not available to Dependabot-triggered workflows; you must use Dependabot secrets instead [5][6]. 3. Security: Using pull_request_target instead of pull_request can provide more flexibility but requires extreme caution, as it grants workflows access to repository secrets, potentially exposing your repository to malicious code if the PR is compromised [1][5][7]. Always validate that the PR creator is indeed Dependabot before performing sensitive operations [1][4].
Citations:
Check the pull request author, not the workflow actor.
A maintainer- or forker-triggered re-run changes
github.actor, so this guard can become true on a Dependabot-authored PR during subsequentpull_request: synchronizeruns while the PR still lacks secrets. Use the PR author for the authorship check.Proposed fix
(github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft && - github.actor != 'dependabot[bot]') + github.event.pull_request.user.login != 'dependabot[bot]')📝 Committable suggestion