Skip to content

Commit e0deed4

Browse files
committed
semgrep checkout the action repo in a subdir to access actions and scripts
1 parent 410a307 commit e0deed4

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/CHANGELOGS/run_semgrep_scan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ All notable changes to the **run_semgrep_scan** callable workflow are documented
44

55
## 1.0.1
66

7-
### Fixed
7+
### Changed
88

9-
- Repo-qualified internal action references to ensure correct resolution when this workflow is called from other repositories. This change allows the workflow to reliably locate and use the intended actions, regardless of the calling repository context.
9+
- Updated workflow to support cross-repository usage by checking out the core-github-actions repository into a subdirectory and referencing all internal actions and scripts from that subdirectory. This ensures that required actions and scripts are always available, regardless of which repository invokes the workflow.
1010

1111
## 1.0.0
1212

.github/workflows/run_semgrep_scan.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,31 @@ jobs:
9292
normalized_baseline: ${{ steps.semgrep.outputs.normalizedBaseline }}
9393

9494
steps:
95-
- name: Checkout code
95+
- name: Checkout Calling Repo
9696
uses: actions/checkout@v4
9797
with:
9898
ref: ${{ inputs.commit_identifier }}
9999
# Full history only when diff/baseline is requested
100100
fetch-depth: ${{ inputs.semgrep_scan_mode == 'full' && '1' || '0' }}
101101

102+
- name: Checkout GHA repo
103+
uses: actions/checkout@v4
104+
with:
105+
repository: ${{ github.action_repository}}
106+
ref: ${{ github.action_ref}}
107+
path: action-repo
108+
109+
- run: |
110+
echo "action repo ${{ github.action_repository}}"
111+
echo "action ref ${{ github.action_ref}}"
112+
echo "----"
113+
ls
114+
echo "-----"
115+
cd action-repo
116+
ls
102117
- name: Check for open PR (by commit)
103118
id: pr_check
104-
uses: OpenSesame/core-github-actions/.github/actions/pr-open-check@actions/pr-open-check/2.0.0
119+
uses: ./action-repo/core-github-actions/.github/actions/pr-open-check
105120
with:
106121
github-token: ${{ secrets.GITHUB_TOKEN }}
107122
commit-identifier: ${{ inputs.commit_identifier }}
@@ -135,7 +150,7 @@ jobs:
135150
SEMGREP_TARGETS: ${{ inputs.semgrep_targets }}
136151
FAIL_LEVEL: ${{ inputs.fail_severity }}
137152
EXTRA_ARGS: ${{ inputs.extra_args }}
138-
run: node scripts/gha-lib/run-semgrep.js
153+
run: node ./action-repo/scripts/gha-lib/run-semgrep.js
139154

140155
- name: Upload Artifact
141156
if: ${{ steps.semgrep.outputs.totalFindings > 0 }}
@@ -265,7 +280,7 @@ jobs:
265280
266281
- name: Upsert PR comment
267282
if: ${{ github.event_name == 'pull_request' || steps.pr_check.outputs.pr_exists == 'true' }}
268-
uses: OpenSesame/core-github-actions/.github/actions/upsert-pr-comment@actions/upsert-pr-comment/1.0.0
283+
uses: ./core-gha/.github/actions/upsert-pr-comment
269284
with:
270285
pr-number: ${{ steps.pr_check.outputs.pr_number }}
271286
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)