Skip to content

Commit

Permalink
Gha improvements (#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
arielkr256 authored Oct 29, 2024
1 parent 569b3c8 commit f06112f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/pre-release-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
pull_request_review:
types: [submitted]

permissions:
contents: read

jobs:
upload:
if: github.head_ref == 'main'
name: Pre-Release Upload to GA
runs-on: ubuntu-latest
env:
API_HOST: ${{ secrets.GA_API_HOST }}
API_TOKEN: ${{ secrets.GA_API_TOKEN }}
steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- name: Validate Secrets
if: ${{ env.GA_API_HOST == '' || env.GA_API_TOKEN == '' }}
run: |
echo "API_HOST or API_TOKEN not set"
exit 0
- name: Checkout panther-analysis
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1

- name: Set python version
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
with:
python-version: "3.11"

- name: Install pipenv
run: pip install pipenv

- name: Setup venv
run: make venv

- name: upload
run: |
pipenv run panther_analysis_tool upload --api-host ${{ env.GA_API_HOST }} --api-token ${{ env.GA_API_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,35 @@ permissions:

jobs:
test:
if: github.event.pull_request.head.repo.fork == true
name: Test
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit

- name: Checkout panther-analysis
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1

- name: Set python version
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
with:
python-version: "3.11"

- name: Install pipenv
run: pip install pipenv

- name: Setup venv
run: make venv

- name: test
run: |
pipenv run panther_analysis_tool test --show-failures-only
test-authenticated:
if: github.event.pull_request.head.repo.fork == false
name: Test
runs-on: ubuntu-latest
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:

jobs:
validate:
if: github.event.review.state == 'approved'
if: github.event.review.state == 'approved' && github.event.pull_request.head.repo.fork == false
name: Validate
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit f06112f

Please sign in to comment.