mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-08-24 20:58:05 +00:00
Add better error handling & rertries
This commit is contained in:
@@ -15,6 +15,7 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
try {
|
||||
const comment = context.payload.comment;
|
||||
const body = comment.body.toLowerCase();
|
||||
const author = comment.user.login;
|
||||
@@ -68,20 +69,19 @@ jobs:
|
||||
);
|
||||
|
||||
if (foundPatterns.length > 0 || suspiciousLinks) {
|
||||
try {
|
||||
// Create a warning comment
|
||||
const warningMessage = `⚠️ Potential scam detected in comment by ${author}:
|
||||
- Suspicious patterns found: ${foundPatterns.join(', ')}
|
||||
${suspiciousLinks ? '- Contains external links' : ''}
|
||||
|
||||
@${context.repo.owner} Please review this comment.`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
|
||||
body: warningMessage
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Failed to create comment:', e);
|
||||
}
|
||||
|
||||
try {
|
||||
// Add 'potential-scam' label
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
@@ -89,4 +89,12 @@ jobs:
|
||||
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
|
||||
labels: ['potential-scam']
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Failed to add label:', e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Workflow error:', e);
|
||||
// Still mark as failure but with more context
|
||||
core.setFailed(`Workflow failed: ${e.message}`);
|
||||
}
|
||||
Reference in New Issue
Block a user