Skip to content

CORS policy blocks script access in development #21

CORS policy blocks script access in development

CORS policy blocks script access in development #21

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 seeking new maintainers';
const message = `${tagline}.
- New issues and PRs may not receive immediate attention
- A new maintenance team must establish itself by March 31, 2025 or 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) {
const comments = await github.rest.issues.listComments(params);
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
if (!await hasExistingNotice(params)) {
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);
throw error; // Re-throw to ensure GitHub Action shows as failed
}