Skip to content

comment when milestone is closed #6

comment when milestone is closed

comment when milestone is closed #6

name: Comment when milestone is closed
on:
milestone:
types: [closed]
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Comment on issue
uses: actions/github-script@v5
with:
script: |
const milestone_number = context.payload.milestone.number;
const milestone_title = context.payload.milestone.title;
// Get all issues associated with the milestone
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
milestone: milestone_number,
state: 'all',
});
// Loop through the issues and post a comment on each one
for (const issue of issues.data) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `This issue has been resolved in Activity Browser [version ${milestone_title}](https://github.com/LCA-ActivityBrowser/activity-browser/releases/tag/${milestone_title}), please [update Activity Browser](https://github.com/LCA-ActivityBrowser/activity-browser#updating-the-ab).`,
});
}