From bbf1b2688ce402153bcfa511e7cc30c964a4f5ce Mon Sep 17 00:00:00 2001 From: Ulises Gascon Date: Fri, 17 Mar 2023 10:45:55 +0100 Subject: [PATCH] feat: added issue assignation and labels close #36 --- README.md | 4 +++- action.yml | 6 ++++++ dist/index.js | 6 +++++- src/action.js | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1fe396b..08b3eed 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ _soon_ - Discovery mode: list all the repos in one or many organizations that are tracked in the OpenSSF Scorecard - Reporting in Markdown with essential information (hash, date, score) and comparative against the prior score. - Self-hosted: The reporting data is stored in json format (including previous records) in the repo itself. -- Generate an issue with the last changes in the scores, including links to the full report. +- Generate an issue (assignation, labels..) with the last changes in the scores, including links to the full report. - Easy to exclude/include new repositories in the scope from any github organization - Extend the markdown template with you own content by using tags - Easy to modify the files and ensure the integrity with Json Schemas @@ -102,6 +102,8 @@ jobs: - `auto-push`: Pushes the code changes to the branch - `generate-issue`: Creates an issue with the scores that had been updated - `issue-title`: Defines the issue title +- `issue-assignees`: List of assignees for the issue +- `issue-labels`: List of labels for the issue - `github-token`: The token usage to create the issue and push the code - `max-request-in-parallel`: Defines the total HTTP Request that can be done in parallel - `discovery-enabled`: Defined if the discovery is enabled diff --git a/action.yml b/action.yml index 27b07ca..70c63f9 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,12 @@ inputs: description: 'Title of the issue to be generated' required: false default: "OpenSSF Scorecard Report Updated!" + issue-assignees: + description: 'List of assignees for the issue to be generated' + required: false + issue-labels: + description: 'List of labels for the issue to be generated' + required: false discovery-enabled: description: 'Enable the automatic update of the scope file' required: false diff --git a/dist/index.js b/dist/index.js index 364dccb..d5ddcf5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -28153,6 +28153,8 @@ async function run () { const autoPush = normalizeBoolean(core.getInput('auto-push')) const autoCommit = normalizeBoolean(core.getInput('auto-commit')) const issueTitle = core.getInput('issue-title') || 'OpenSSF Scorecard Report Updated!' + const issueAssignees = core.getInput('issue-assignees').split(',').filter(x => x !== '').map(x => x.trim()) || [] + const issueLabels = core.getInput('issue-labels').split(',').filter(x => x !== '').map(x => x.trim()) || [] const githubToken = core.getInput('github-token') const discoveryEnabled = normalizeBoolean(core.getInput('discovery-enabled')) const discoveryOrgs = core.getInput('discovery-orgs').split(',').filter(x => x !== '').map(x => x.trim()) || [] @@ -28275,7 +28277,9 @@ async function run () { await octokit.rest.issues.create({ ...context.repo, title: issueTitle, - body: issueContent + body: issueContent, + labels: issueLabels, + assignees: issueAssignees }) } } diff --git a/src/action.js b/src/action.js index b50635b..0a20e38 100644 --- a/src/action.js +++ b/src/action.js @@ -23,6 +23,8 @@ async function run () { const autoPush = normalizeBoolean(core.getInput('auto-push')) const autoCommit = normalizeBoolean(core.getInput('auto-commit')) const issueTitle = core.getInput('issue-title') || 'OpenSSF Scorecard Report Updated!' + const issueAssignees = core.getInput('issue-assignees').split(',').filter(x => x !== '').map(x => x.trim()) || [] + const issueLabels = core.getInput('issue-labels').split(',').filter(x => x !== '').map(x => x.trim()) || [] const githubToken = core.getInput('github-token') const discoveryEnabled = normalizeBoolean(core.getInput('discovery-enabled')) const discoveryOrgs = core.getInput('discovery-orgs').split(',').filter(x => x !== '').map(x => x.trim()) || [] @@ -145,7 +147,9 @@ async function run () { await octokit.rest.issues.create({ ...context.repo, title: issueTitle, - body: issueContent + body: issueContent, + labels: issueLabels, + assignees: issueAssignees }) } }