Fix 'owner' and 'repo' for the lock workflow

This commit is contained in:
Adam Turner 2024-11-17 18:34:20 +00:00
parent b27c0e2c53
commit 659478c603

View File

@ -23,14 +23,15 @@ jobs:
const _FOUR_WEEKS_MILLISECONDS = 28 * 24 * 60 * 60 * 1000;
const _FOUR_WEEKS_DATE = new Date(Date.now() - _FOUR_WEEKS_MILLISECONDS);
const FOUR_WEEKS_AGO = `${_FOUR_WEEKS_DATE.toISOString().substring(0, 10)}T00:00:00Z`;
const OWNER = context.repo.repo;
const REPO = context.repo.owner;
try {
const {owner, repo} = github.context.repo;
for (const thread_type of ["issue", "pr"]) {
core.debug(`Finding ${thread_type}s to lock`);
const query = thread_type === "issue"
? `repo:${owner}/${repo} updated:<${FOUR_WEEKS_AGO} is:closed is:unlocked is:issue`
: `repo:${owner}/${repo} updated:<${FOUR_WEEKS_AGO} is:closed is:unlocked is:pr`;
? `repo:${OWNER}/${REPO} updated:<${FOUR_WEEKS_AGO} is:closed is:unlocked is:issue`
: `repo:${OWNER}/${REPO} updated:<${FOUR_WEEKS_AGO} is:closed is:unlocked is:pr`;
core.debug(`Using query '${query}'`);
// https://octokit.github.io/rest.js/v21/#search-issues-and-pull-requests
const {data: {items: results}} = await github.rest.search.issuesAndPullRequests({
@ -45,8 +46,8 @@ jobs:
core.debug(`Locking #${thread_num} (${thread_type})`);
// https://octokit.github.io/rest.js/v21/#issues-lock
await github.rest.issues.lock({
owner,
repo,
OWNER,
REPO,
issue_number: thread_num,
lock_reason: "resolved",
});