Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
fetch-depth: 0

- name: Install dependencies
run: npm ci
Expand All @@ -31,20 +32,30 @@ jobs:
with:
script: |
const pr = context.payload.pull_request;
const files = await github.paginate(
github.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
}
);
let changed = [];

if (pr) {
const files = await github.paginate(
github.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
}
);

const changed = files
.map(f => f.filename)
.filter(f => f.endsWith('.js') || f.endsWith('.vue'));
changed = files.map(f => f.filename);
} else {
const { execSync } = require('child_process');
const diff = execSync('git diff --name-only HEAD~1 HEAD').toString();
changed = diff.split('\n').filter(Boolean);
}

const filtered = changed.filter(
f => f.endsWith('.js') || f.endsWith('.vue')
);

core.setOutput('files', changed.join(' '));
core.setOutput('files', filtered.join(' '));

- name: Run ESLint
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
// 30+ days: Close PR
if (updatedAt < thirtyDaysAgo) {
console.log(`PR #${prNumber} is 30+ days old, closing`);

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -67,9 +67,9 @@ jobs:
}

// 14+ days: Add warning comment (if not already warned)
if (updatedAt < fourteenDaysAgo && !labels.includes('stale')) {
if (updatedAt < fourteenDaysAgo) {
console.log(`PR #${prNumber} is 14+ days old, adding warning`);

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -91,7 +91,7 @@ jobs:
// 7+ days: Add stale label
if (updatedAt < sevenDaysAgo && !labels.includes('stale')) {
console.log(`PR #${prNumber} is 7+ days old, marking as stale`);

await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down