Skip to content

Commit 6eaaa5f

Browse files
[PETOSS-829] Allow codegen validation to be run from forked PRs (#763)
* [PETOSS-829] Use var for app_id as per docs * [PETOSS-829] Replace access token action * [PETOSS-829] Split workflows and run codegen validation via pull_request_target This is necessary as we can't access secrets from pull_request from forks
1 parent d6feb8b commit 6eaaa5f

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

.github/workflows/pr-linting.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: PR Linting
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
linting:
9+
runs-on: ubuntu-latest
10+
name: MegaLinter Validation
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: MegaLinter
16+
uses: oxsecurity/megalinter/flavors/documentation@v9

.github/workflows/pr-validation.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
name: PR Validation
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, reopened, synchronize]
6-
push:
7-
branches:
8-
- master
6+
branches: [master]
97

108
jobs:
11-
linting:
12-
runs-on: ubuntu-latest
13-
name: MegaLinter Validation
14-
steps:
15-
- name: Checkout repository
16-
uses: actions/checkout@v4
17-
18-
- name: MegaLinter
19-
uses: oxsecurity/megalinter/flavors/documentation@v9
20-
219
codegen-validation:
2210
runs-on: ubuntu-latest
2311
name: Codegen Repo Validation
@@ -46,7 +34,7 @@ jobs:
4634
env:
4735
GH_TOKEN: ${{ steps.get_access_token.outputs.token }}
4836
run: |
49-
BRANCH_NAME="${{ github.event_name == 'pull_request' && github.head_ref || 'master' }}"
37+
BRANCH_NAME="${{ github.event.pull_request.head.sha }}"
5038
5139
# Trigger the workflow and capture the response
5240
gh workflow run pr.yml \

0 commit comments

Comments
 (0)