Skip to content

Commit 3eb84e5

Browse files
committed
OWASP OWASP#714 : Fixing workflow triggering isues
1 parent 5573de4 commit 3eb84e5

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

.github/workflows/dast-zap-test.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ jobs:
1717
uses: actions/checkout@v4
1818
- name: Trigger Building JAR cache
1919
if: steps.cache.outputs.cache-hit != 'true'
20-
uses: actions/github-script@v4
21-
with:
22-
script: |
23-
const { data: workflows } = await octokit.actions.listRepoWorkflows({
24-
owner: context.repo.owner,
25-
repo: context.repo.repo
26-
});
27-
const secondWorkflow = workflows.workflows.find(w => w.name === "building-jar-cache.yml");
28-
if (secondWorkflow) {
29-
await octokit.actions.createWorkflowDispatch({
30-
owner: context.repo.owner,
31-
repo: context.repo.repo,
32-
workflow_id: secondWorkflow.id
33-
});
34-
}
35-
token: ${{ secrets.GITHUB_TOKEN }}
20+
run: |
21+
const { Octokit } = require("@octokit/core");
22+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
23+
const { data: workflows } = await octokit.request("GET /repos/commjoen/wrongsecrets/actions/workflows", {
24+
owner: process.env.GITHUB_REPOSITORY.split("/")[0],
25+
repo: process.env.GITHUB_REPOSITORY.split("/")[1]
26+
});
27+
const secondWorkflow = workflows.workflows.find(w => w.name === "building-jar-cache.yml");
28+
if (secondWorkflow) {
29+
await octokit.request("POST /repos/commjoen/wrongsecrets/actions/workflows/Building JAR cache/dispatches", {
30+
owner: process.env.GITHUB_REPOSITORY.split("/")[0],
31+
repo: process.env.GITHUB_REPOSITORY.split("/")[1],
32+
workflow_id: secondWorkflow.id
33+
});
34+
}
3635
- name: Start wrongsecrets
3736
run: nohup ./mvnw spring-boot:run -Dspring-boot.run.profiles=without-vault &
3837
- name: ZAP Scan

0 commit comments

Comments
 (0)