Skip to content

Commit

Permalink
Update log-contribution.js
Browse files Browse the repository at this point in the history
Trying to get the issue to close. Another approach?

Signed-off-by: Sean P. Goggins <s@goggins.com>
  • Loading branch information
sgoggins authored Aug 28, 2024
1 parent aa8f8bb commit 528efde
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions log-contribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@ const github = require('@actions/github');

console.log(`New contribution added to ${filePath}`);

// Close the issue after successfully adding the entry
if (octokit.issues) {
// Attempt to close the issue after successfully adding the entry
try {
await octokit.issues.update({
...context.repo,
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
});
console.log(`Issue #${issue.number} closed.`);
} else {
console.log(`Failed to close issue #${issue.number}.`);
console.log(`Issue #${issue.number} closed successfully.`);
} catch (error) {
console.error(`Failed to close issue #${issue.number}.`, error);
}
} else {
console.log('No "contribution" label found, skipping update.');
Expand Down

0 comments on commit 528efde

Please sign in to comment.