Skip to content

chore(deps): update actions/setup-node action to v6.1.0 (#330) #226

chore(deps): update actions/setup-node action to v6.1.0 (#330)

chore(deps): update actions/setup-node action to v6.1.0 (#330) #226

Workflow file for this run

name: "Reminder for 'run npm audit'"
on:
schedule:
- cron: '0 22 * * *'
workflow_dispatch:
push:
branches:
- 'main'
jobs:
run-npm-audit:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
if: github.repository == 'line/line-bot-mcp-server'
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: '24'
# Enable this when setup-node v5 is released
# package-manager-cache: false
- name: Run npm audit and check diff
id: audit
run: .github/scripts/npm-audit.sh
continue-on-error: true
- name: Create or update reminder issue
if: steps.audit.outcome == 'failure'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
TZ: 'Asia/Tokyo'
with:
script: |
const { owner, repo } = context.repo;
const title = 'Reminder: run npm audit';
const securityURL = `https://github.com/${owner}/${repo}/security`;
const baseBody = [
'Fix all vulnerabilities. You can check with `.github/scripts/npm-audit.sh` locally, then send a PR with the fixes.',
`After fixing, make sure the vulnerabilities count in **${securityURL}** is **0**.`
].join('\n\n');
const { data: result } = await github.rest.search.issuesAndPullRequests({
q: `repo:${owner}/${repo} is:issue is:open in:title "${title}"`
});
const today = new Date();
if (result.total_count === 0) {
await github.rest.issues.create({
owner,
repo,
title,
body: `${baseBody}\n\n0 days have passed.`
});
} else {
const issue = result.items[0];
const created = new Date(issue.created_at);
const diffDays = Math.floor((today - created) / 86_400_000);
await github.rest.issues.update({
owner,
repo,
issue_number: issue.number,
body: `${baseBody}\n\n${diffDays} days have passed.`
});
}