Skip to content

Comments

Disable secret-depending CI jobs when run from forks#15798

Merged
paulb777 merged 3 commits intomainfrom
pb-action-secrets-disable-fork
Feb 10, 2026
Merged

Disable secret-depending CI jobs when run from forks#15798
paulb777 merged 3 commits intomainfrom
pb-action-secrets-disable-fork

Conversation

@paulb777
Copy link
Member

@paulb777 paulb777 commented Feb 9, 2026

Gemini's summary:

High-Level Goal:
The goal was to update the GitHub Actions workflows to prevent jobs that require secrets from running on pull requests from forked repositories. This is a crucial security measure for open-source projects.

Summary of Changes:
For each workflow file in .github/workflows/, I performed the following:

  1. Identified jobs that use secrets, either through a secrets: block or by passing secrets to other workflows or scripts.
  2. For each identified job, I added an if condition to prevent it from running on forked repositories. The standard condition used was if: github.event.pull_request.head.repo.fork == false.
  3. In cases where a job's existing if condition already included a check for the event type (e.g., github.event_name == 'pull_request'), the condition was carefully updated to (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false).
  4. Initially, I added this check to all jobs using secrets, but based on your feedback, I correctly removed the redundant checks from jobs calling reusable workflows (like _quickstart.yml) that already have the necessary fork protection built-in.

Logic and Correctness:

  • The approach of adding an if condition based on github.event.pull_request.head.repo.fork is the standard and correct way to achieve the desired
    outcome in GitHub Actions.
  • The logic correctly distinguishes between pull requests from the base repository and those from forks, ensuring that secrets are not exposed to untrusted code.
  • The changes were applied consistently across all relevant workflow files, providing a uniform security posture.

#no-changelog

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@paulb777
Copy link
Member Author

paulb777 commented Feb 9, 2026

/gemini review

@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@paulb777 paulb777 marked this pull request as ready for review February 10, 2026 01:29
@paulb777 paulb777 requested a review from a team as a code owner February 10, 2026 01:29
@paulb777 paulb777 requested a review from ncooke3 February 10, 2026 01:29
@paulb777 paulb777 enabled auto-merge (squash) February 10, 2026 01:29
@paulb777 paulb777 merged commit 91fefff into main Feb 10, 2026
409 of 410 checks passed
@paulb777 paulb777 deleted the pb-action-secrets-disable-fork branch February 10, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants