Skip to content

Commit 8b743c9

Browse files
Merge pull request #5 from Contrast-Security-OSS/PRODSEC-462
Prodsec 462 - fix policy url
2 parents a3aa399 + 28ece0c commit 8b743c9

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7-
#### [v1.0.1](https://github.com/Contrast-Security-OSS/actionbot/commit/fa95c969a50f6c331ec8ef19580fb9b8521851ca...https://github.com/Contrast-Security-OSS/actionbot/pull/4/commits/5f6c36987c9e39b866fd3b7aeed4203aeedb6265)
7+
#### [v1.0.3](https://github.com/Contrast-Security-OSS/actionbot/compare/v1.0.0...v1.0.3)
88

99
- Bump eslint-plugin-github from 5.1.8 to 6.0.0 [`#1`](https://github.com/Contrast-Security-OSS/actionbot/pull/1)
1010
- Migration build [`#3`](https://github.com/Contrast-Security-OSS/actionbot/pull/3)

lib/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39024,11 +39024,16 @@ function run(context) {
3902439024
});
3902539025
}
3902639026
else {
39027-
// Load up the github policy list
39027+
// Correctly extract the file path from the policyUrl
39028+
const filePath = policyUrl
39029+
.replace("https://github.com/", "")
39030+
.split("/")
39031+
.slice(4) // Start after 'blob/main'
39032+
.join("/");
3902839033
const response = yield client.rest.repos.getContent({
3902939034
owner: github.context.repo.owner,
3903039035
repo: github.context.repo.repo,
39031-
path: policyUrl.replace("https://github.com/", "").split("/").slice(2).join("/"),
39036+
path: filePath, // Use the corrected file path
3903239037
});
3903339038
if (response.data && "content" in response.data) {
3903439039
const content = Buffer.from(response.data.content, "base64").toString("utf-8");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "actionbot",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"private": true,
55
"description": "Github Action Policy Checker as a Github Action",
66
"main": "lib/index.js",

src/main.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,17 @@ async function run(context: typeof github.context): Promise<void> {
171171
// Handle the error appropriately (e.g., throw an error, set a default policy)
172172
});
173173
} else {
174-
// Load up the github policy list
174+
// Correctly extract the file path from the policyUrl
175+
const filePath = policyUrl
176+
.replace("https://github.com/", "")
177+
.split("/")
178+
.slice(4) // Start after 'blob/main'
179+
.join("/");
180+
175181
const response = await client.rest.repos.getContent({
176182
owner: github.context.repo.owner,
177183
repo: github.context.repo.repo,
178-
path: policyUrl
179-
.replace("https://github.com/", "")
180-
.split("/")
181-
.slice(2)
182-
.join("/"),
184+
path: filePath, // Use the corrected file path
183185
});
184186

185187
if (response.data && "content" in response.data) {

0 commit comments

Comments
 (0)