Skip to content

Maintenance Status Notice #13

Maintenance Status Notice

Maintenance Status Notice #13

Workflow file for this run

name: 'Maintenance Status Notice'
on:
issues:
types: [opened]
pull_request:
types: [opened]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
add-notice:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/github-script@v6
with:
script: |
const tagline = '⚠️ **Important Notice:** CRXJS is currently seeking new maintainers';
const message = `${tagline}.
- New issues and PRs may not receive immediate attention
- If no maintenance team is established by March 31, 2025, this repository will be archived on June 1, 2025.
- [Learn more about the transition](https://github.com/crxjs/chrome-extension-tools/discussions/974)
---
*This is an automated message. Please do not reply to this comment.*`;
async function hasExistingNotice(params) {
console.log(Object.keys(github.rest));
const comments = await github.rest.issues.listComments(params);
console.log('Existing comments:', comments.data);
const botLogin = 'github-actions[bot]';
return comments.data.some(comment =>
comment.user.login === botLogin && comment.body.includes(tagline)
);
}
try {
const owner = 'crxjs';
const repo = 'chrome-extension-tools';
let issueNumber;
// Determine context and get issue/PR number
if (context.eventName === 'issues' || context.eventName === 'issue_comment') {
issueNumber = context.issue.number;
} else {
issueNumber = context.payload.pull_request.number;
}
const params = {
owner,
repo,
issue_number: issueNumber,
};
// Only post if no existing notice found
const shouldPostNotice = !await hasExistingNotice(params);
console.log('Should post notice:', shouldPostNotice);
if (shouldPostNotice) {
await github.rest.issues.createComment({ ...params, body: message });
console.log('Maintenance notice posted successfully.');
} else {
console.log('Maintenance notice already exists. Skipping comment.');
}
} catch (error) {
console.error('Error in Maintenance Notice Action:', error);
throw error; // Re-throw to ensure GitHub Action shows as failed
}