Skip to content

Commit 0f1c322

Browse files
update workflow
1 parent 87fd55a commit 0f1c322

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/branch-notification.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,21 @@ jobs:
2424
});
2525
if (oldBranches.length > 0) {
2626
console.log(`Found ${oldBranches.length} branches older than 180 days.`);
27-
// Add notification logic here
27+
for (const branch of oldBranches) {
28+
const { data: commits } = await github.repos.listCommits({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
sha: branch.name,
32+
per_page: 1,
33+
});
34+
const commitAuthorEmail = commits[0].commit.author.email;
35+
await github.repos.createCommitComment({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
commit_sha: commits[0].sha,
39+
body: `This branch is more than 180 days old. Consider deleting or archiving it.`
40+
});
41+
}
2842
} else {
2943
console.log('No branches older than 180 days were found.');
3044
}

0 commit comments

Comments
 (0)