Skip to content

Commit

Permalink
feat: ignore deploying preview environment for fork PRs (#4578)
Browse files Browse the repository at this point in the history
# Description

This PR updates the `package.yml` and `close-pr.yml` workflows so a
preview environment is not created/removed from fork PRs.

**Type of change**

- [x] Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

Created a PR from fork: #4581

**Checklist**

- [ ] I added relevant documentation
- [x] I followed the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the `CHANGELOG.md` file (See
https://keepachangelog.com/)
  • Loading branch information
gabrielmbmb committed Feb 9, 2024
1 parent dd10db9 commit d65a445
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/close-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@ name: Close Pull Request

on:
pull_request:
types: [ closed ]
types: [closed]

jobs:
teardown_pr_environment:
name: Teardown Cloud Run PR environment
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository

# Grant permissions to `GITHUB_TOKEN` for Google Cloud Workload Identity Provider
permissions:
contents: read
id-token: write

steps:
- uses: 'actions/checkout@v3'
- uses: "actions/checkout@v3"

- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v1'
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WIP }}
service_account: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT }}

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
uses: "google-github-actions/setup-gcloud@v1"
with:
version: '>= 435.0.0'
version: ">= 435.0.0"

- name: Remove PR environment if exists
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ jobs:
needs: build_quickstart_for_develop_docker_image
if: |
!cancelled() &&
github.event.pull_request.head.repo.full_name == github.repository &&
needs.build_quickstart_for_develop_docker_image.result == 'success' &&
github.event_name == 'pull_request' && github.event.pull_request.draft == false
with:
Expand Down

0 comments on commit d65a445

Please sign in to comment.