Skip to content

Commit

Permalink
Merge pull request #86 from cloudnativegeo/modify-preview-action
Browse files Browse the repository at this point in the history
Add restriction to only run for PRs with main as the target.
  • Loading branch information
zacdezgeo authored Oct 30, 2023
2 parents 6291a80 + fa302b1 commit 29b8f2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,32 @@ on:
pull_request:

jobs:
pr-target-test:
runs-on: ubuntu-latest
steps:
- name: Fail if target is not staging (for PRs only)
if: github.event_name == 'pull_request'
run: |
if [[ "${{ github.event.pull_request.base.ref }}" != "main" || "${{ github.event.pull_request.head.ref }}" == "staging" ]]; then
echo "Target branch is acceptable."
else
echo "Only PRs from staging can target main."
exit 1
fi
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: run pre-commit
- name: Run pre-commit
run: |
python -m pip install pre-commit
pre-commit run --all-files
2 changes: 2 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Deploy PR previews

on:
pull_request:
branches:
- main
types:
- opened
- reopened
Expand Down

0 comments on commit 29b8f2b

Please sign in to comment.