Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Panayil <[email protected]>
  • Loading branch information
sachin-panayil committed Dec 23, 2024
1 parent 0f8cb74 commit ec41d1d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/send-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Test New Repolinter Action
on:
push:
name: 'Create a PR based on validation'

on:
workflow_dispatch: {}

jobs:
test:
repolinter-action:
runs-on: ubuntu-latest
name: Run Repolinter
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- name: Test Local Action
uses: sachin-panayil/repolinter-action@main
- name: Checkout Repo
uses: actions/checkout@v4
- name: 'Run Repolinter'
uses: DSACMS/repolinter-action@main
with:
output_type: 'pull-request'
labels: 'repolinter, OSPO, Tier 1'


output_type: 'pull-request'
labels: 'repolinter, OSPO, Tier 1'
7 changes: 2 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ function run(disableRetry) {
// verify the output type is correct
if (OUTPUT_TYPE !== 'exit-code' && OUTPUT_TYPE !== 'issue' && OUTPUT_TYPE !== "pull-request")
throw new Error(`Invalid output paramter value ${OUTPUT_TYPE} There is another error here`);
// verify the label name is a string
if (!LABEL_NAME)
throw new Error(`Invalid label name value ${LABEL_NAME}`);
// verify the label color is a color
Expand Down Expand Up @@ -712,11 +711,9 @@ function run(disableRetry) {
}
});
core.startGroup('Sending a PR');
core.info(`Lables: ${LABELS} `);
try {
const [owner, repo] = REPO.split('/');
const originalLables = LABELS.replace(/\s/g, "");
const cleanedLabels = originalLables.split(",");
const cleanedLabels = LABELS.split(",");
const jsonOutput = repolinter_1.jsonFormatter.formatOutput(result, true);
const files = getFileChanges_1.getFileChanges(jsonOutput);
if (Object.keys(files).length !== 0) {
Expand All @@ -734,8 +731,8 @@ function run(disableRetry) {
}]
});
if (pr) {
core.info(`Lables: ${cleanedLabels} `);
core.info(`Created PR: ${pr.data.html_url}`);
core.info(`Labels: ${LABELS}`);
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export default async function run(disableRetry?: boolean): Promise<void> {
// verify the output type is correct
if (OUTPUT_TYPE!== 'exit-code' && OUTPUT_TYPE !== 'issue' && OUTPUT_TYPE !== "pull-request")
throw new Error(`Invalid output paramter value ${ OUTPUT_TYPE} There is another error here`)
// verify the label name is a string
if (!LABEL_NAME) throw new Error(`Invalid label name value ${LABEL_NAME}`)
// verify the label color is a color
if (!/[0-9a-fA-F]{6}/.test(LABEL_COLOR))
Expand Down Expand Up @@ -166,12 +165,10 @@ export default async function run(disableRetry?: boolean): Promise<void> {
})

core.startGroup('Sending a PR')
core.info(`Lables: ${LABELS} `)

try {
const [owner, repo] = REPO.split('/')
const originalLables = LABELS.replace(/\s/g, "");
const cleanedLabels = originalLables.split(",")
const cleanedLabels = LABELS.split(",")

const jsonOutput = jsonFormatter.formatOutput(result, true)
const files = getFileChanges(jsonOutput)
Expand All @@ -192,9 +189,9 @@ export default async function run(disableRetry?: boolean): Promise<void> {
})

if (pr) {
core.info(`Lables: ${cleanedLabels} `)
core.info(`Created PR: ${pr.data.html_url}`)
core.info(`Labels: ${LABELS}`)
}
}

} else {
console.log("No changes detected")
Expand Down Expand Up @@ -234,4 +231,4 @@ export default async function run(disableRetry?: boolean): Promise<void> {
} else if ((error as RequestError).stack) console.log("core.error(error.stack)")
else core.error((error as RequestError))
}
}
}

0 comments on commit ec41d1d

Please sign in to comment.