Skip to content

Commit 6004fac

Browse files
committed
Remove unused code and modify dependabot.yml
1 parent 8b5a251 commit 6004fac

File tree

3 files changed

+8
-99
lines changed

3 files changed

+8
-99
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
version: 2
2+
3+
multi-ecosystem-groups:
4+
infrastructure:
5+
schedule:
6+
interval: "daily"
7+
28
updates:
39
- package-ecosystem: "bun" # See documentation for possible values
410
target-branch: "main"
511
directory: "/" # Location of package manifests
6-
schedule:
7-
interval: "daily"
812
- package-ecosystem: "github-actions"
9-
directory: "/.github/workflows"
10-
schedule:
11-
interval: "weekly"
13+
target-branch: "main"
14+
directory: "/.github/workflows"

index.js

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const secret = process.env.WEBHOOK_SECRET;
1818
const newPRs = fs.readFileSync('./message/opened.md', 'utf8');
1919
const mergedPRs = fs.readFileSync('./message/merged.md', 'utf8');
2020
const draftPRs = fs.readFileSync('./message/draft.md', 'utf8');
21-
//const success = fs.readFileSync('./message/success.md', 'utf8');
2221

2322
Sentry.init({
2423
dsn: sentryDsn,
@@ -100,96 +99,6 @@ app.webhooks.on('pull_request.closed', async ({ octokit, payload }) => {
10099
}
101100
});
102101

103-
/*
104-
// Check if the workflow ran succesfully
105-
app.webhooks.on('workflow_run.completed', async ({ octokit, payload }) => {
106-
try {
107-
if (payload.workflow_run.event === "pull_request") {
108-
const pr = payload.workflow_run.pull_requests[0];
109-
if (payload.workflow_run.conclusion === "success") {
110-
console.log(`Workflow passed in #${pr.number} on https://github.com/${payload.repository.full_name}, sending success message!`);
111-
await octokit.rest.issues.createComment({
112-
owner:payload.repository.owner.login,
113-
repo: payload.repository.name,
114-
issue_number: pr.number,
115-
body: success
116-
});
117-
console.log(`Succesfully sent the success message for #${pr.number} on https://github.com/${payload.repository.full_name}`);
118-
} else { return; };
119-
} else { return; };
120-
} catch (error) {
121-
Sentry.captureException(error);
122-
fastify.log.error(error);
123-
if (error.response) {
124-
console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`);
125-
} else {
126-
console.error(error);
127-
}
128-
}
129-
});
130-
131-
// Check if the workflow failed
132-
app.webhooks.on('workflow_job.completed', async ({ octokit, payload }) => {
133-
try {
134-
if (payload.workflow_job.conclusion === "failure") {
135-
const actions = await octokit.request(`GET ${payload.workflow_job.run_url}`);
136-
if (actions.data.event === "pull_request") {
137-
const commit = await octokit.rest.repos.listPullRequestsAssociatedWithCommit({
138-
owner: payload.repository.owner.login,
139-
repo: payload.repository.name,
140-
commit_sha: actions.data.head_sha,
141-
});;
142-
const pr = commit.data[0].number;
143-
console.log(`Workflow failed in #${pr} on https://github.com/${payload.repository.full_name}, sending failed message!`);
144-
const logs = await octokit.request(`GET /repos/${payload.repository.owner.login}/${payload.repository.name}/actions/jobs/${payload.workflow_job.id}/logs`);
145-
const logsText = logs.data;
146-
const removeTime = logsText.split('\n').map(line => line.replace(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z\s+/, ''));
147-
const start1 = removeTime.findIndex(line => line.includes("##[group]Run npx ava tests/*.test.js --timeout=1m"));
148-
const start2 = removeTime.findIndex((line, i) => i > start1 && line.includes("##[endgroup]"));
149-
const end = removeTime.findIndex(line => line.includes("##[error]Process completed with exit code 1."));
150-
const finalLogs = removeTime.slice(start2 + 2, end);
151-
// did this to make my life easier
152-
const failed = `
153-
# Checks failed!
154-
155-
The checks for the pull request has failed, please check the error logs below this message. If you don't know why it failed or don't know how to fix it, either wait for a maintainer to review the pull request, ask in a [GitHub issue](https://github.com/is-a-dev/register/issues/new/choose) or ask in the [Discord server](https://discord.gg/is-a-dev-830872854677422150).
156-
157-
<details>
158-
<summary><h3>Error logs</h3></summary>
159-
160-
~~~
161-
${finalLogs.join('\n').replace(/</g, '&lt;').replace(/>/g, '&gt;')}
162-
~~~
163-
164-
</details>
165-
166-
[Link for error logs](${payload.workflow_job.html_url})
167-
`;
168-
await octokit.rest.issues.createComment({
169-
owner: payload.repository.owner.login,
170-
repo: payload.repository.name,
171-
issue_number: pr,
172-
body: failed
173-
});
174-
console.log(`Succesfully sent the failed message for #${pr} on https://github.com/${payload.repository.full_name}`);
175-
} else {
176-
return;
177-
}
178-
} else {
179-
return;
180-
}
181-
} catch (error) {
182-
Sentry.captureException(error);
183-
fastify.log.error(error);
184-
if (error.response) {
185-
console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`);
186-
} else {
187-
console.error(error);
188-
}
189-
}
190-
});
191-
*/
192-
193102
// Handle errors
194103
app.webhooks.onError((error) => {
195104
Sentry.captureException(error);

message/success.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)