Skip to content

Commit 8c4173e

Browse files
DeanChensjcopybara-github
authored andcommitted
fix(ci): Restrict GitHub Actions to main/v1 branches and main repository
Update workflows to ensure they only run on the main repository (google/adk-python) and target main or v1 branches where applicable. This prevents workflows from running on forks and restricts merge blocking to main branch. Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 940031708
1 parent c961af9 commit 8c4173e

8 files changed

Lines changed: 10 additions & 1 deletion

.github/workflows/analyze-releases-for-adk-docs-updates.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ on:
3737

3838
jobs:
3939
analyze-new-release-for-adk-docs-updates:
40+
if: github.repository == 'google/adk-python'
4041
runs-on: ubuntu-latest
4142
permissions:
4243
contents: read

.github/workflows/block-merge.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ name: Do Not Merge on GitHub
1616

1717
on:
1818
pull_request:
19+
branches: [main]
1920
types: [opened, reopened, synchronize]
2021

2122
jobs:
2223
block-merge:
24+
if: github.repository == 'google/adk-python'
2325
name: maintainers will submit via Copybara
2426
runs-on: ubuntu-latest
2527
steps:

.github/workflows/discussion_answering.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ permissions:
2626
jobs:
2727
agent-answer-questions:
2828
if: >-
29+
github.repository == 'google/adk-python' && (
2930
(github.event_name == 'discussion' && github.event.discussion.category.name == 'Q&A') ||
3031
(github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@adk-bot') && github.event.sender.login != 'adk-bot')
32+
)
3133
runs-on: ubuntu-latest
3234

3335
steps:

.github/workflows/release-cherry-pick.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434

3535
jobs:
3636
cherry-pick:
37+
if: github.repository == 'google/adk-python'
3738
runs-on: ubuntu-latest
3839
steps:
3940
- name: Determine Branch Configurations

.github/workflows/release-cut.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ permissions:
4747

4848
jobs:
4949
cut-or-regenerate:
50+
if: github.repository == 'google/adk-python'
5051
runs-on: ubuntu-latest
5152
steps:
5253
- name: Determine Branch Configurations

.github/workflows/release-finalize.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ permissions:
2929

3030
jobs:
3131
finalize:
32-
if: github.event.pull_request.merged == true
32+
if: github.event.pull_request.merged == true && github.repository == 'google/adk-python'
3333
runs-on: ubuntu-latest
3434
steps:
3535
- name: Check for release-please PR

.github/workflows/release-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ permissions:
2626

2727
jobs:
2828
publish:
29+
if: github.repository == 'google/adk-python'
2930
runs-on: ubuntu-latest
3031
steps:
3132
- name: Validate branch

.github/workflows/release-update-adk-web.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ on:
2828

2929
jobs:
3030
update-frontend:
31+
if: github.repository == 'google/adk-python'
3132
runs-on: ubuntu-latest
3233
permissions:
3334
contents: write

0 commit comments

Comments
 (0)