-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into feat/aa-v7
- Loading branch information
Showing
723 changed files
with
277,331 additions
and
4,140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,26 @@ | ||
module.exports = async ({ github, context, header, body }) => { | ||
const comment = [header, body].join("\n"); | ||
|
||
let issueNumber; | ||
|
||
console.log("context.eventName", context.eventName); | ||
if (context.eventName === "pull_request") { | ||
// For pull_request events, the number is directly available | ||
if (!context.payload.pull_request) { | ||
console.error("No pull request info available in payload"); | ||
return; // Exit if pull request info is not available | ||
} | ||
issueNumber = context.payload.pull_request.number; | ||
console.log("Pull Request Number: ", issueNumber); | ||
} else if (context.eventName === "push") { | ||
// For push events, try to get the associated pull requests | ||
const pullRequests = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: "open", | ||
head: `${context.repo.owner}:${context.ref.replace("refs/heads/", "")}`, | ||
}); | ||
|
||
if (pullRequests && pullRequests.data && pullRequests.data.length > 0) { | ||
// If there are open pull requests associated with the push, take the first one | ||
issueNumber = pullRequests.data[0].number; | ||
console.log("Associated Pull Request Number: ", issueNumber); | ||
} else { | ||
console.log("No associated pull requests found for this push event."); | ||
return; // Exit early if no associated PR is found | ||
} | ||
} else { | ||
// If the event is neither pull_request nor push, log it and exit | ||
console.log(`Unhandled event type: ${context.eventName}`); | ||
return; | ||
} | ||
|
||
// Get the existing comments | ||
const { data: comments } = await github.rest.issues.listComments({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issueNumber, | ||
issue_number: context.payload.number, | ||
}); | ||
|
||
// Find any comment already made by the bot | ||
const botComment = comments.find( | ||
(comment) => comment.user.id === 41898282 && comment.body.startsWith(header) | ||
(comment) => | ||
// github-actions bot user | ||
comment.user.id === 41898282 && comment.body.startsWith(header) | ||
); | ||
|
||
const commentFn = botComment ? "updateComment" : "createComment"; | ||
|
||
// Create or update the comment | ||
await github.rest.issues[commentFn]({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: comment, | ||
...(botComment | ||
? { comment_id: botComment.id } | ||
: { issue_number: issueNumber }), | ||
: { issue_number: context.payload.number }), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "solhint:default" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.