Skip to content

fix: add logic.js and api.js + fix require path resolution (#28) - #28

Merged
Romuald Lemesle (RomuDeuxfois) merged 3 commits into
mainfrom
fix/move-closed-issue-missing-js-files
Jun 19, 2026
Merged

fix: add logic.js and api.js + fix require path resolution (#28)#28
Romuald Lemesle (RomuDeuxfois) merged 3 commits into
mainfrom
fix/move-closed-issue-missing-js-files

Conversation

@RomuDeuxfois

Copy link
Copy Markdown
Member

Problem

The move-closed-issue-to-milestone action was failing with:

Error: Cannot find module '/home/runner/work/openaev/openaev/actions/move-closed-issue-to-milestone/logic.js'

Two root causes:

  1. logic.js and api.js were never committed — the action referenced them but they didn't exist in the repo.
  2. require() paths were workspace-relativeactions/github-script resolves require() relative to the caller's workspace, not the action's own directory. So ./actions/move-closed-issue-to-milestone/logic.js resolved to /home/runner/work/openaev/openaev/actions/... instead of the action checkout path.

Fix

  • Added logic.jsdecide() function (label matching + milestone check)
  • Added api.jsgetIssue(), findOrCreateMilestone(), setIssueMilestone() wrappers
  • Fixed action.yml: expose github.action_path as ACTION_PATH env var and use process.env.ACTION_PATH + '/logic.js' in require() — this always resolves to the action's own directory regardless of the calling repo

@Filigran-Automation

Copy link
Copy Markdown
Member

🤖 [AI-generated]

Hey Romuald Lemesle (@RomuDeuxfois)! 👋 Thanks a lot for opening PR #28 — the Problem / Fix write-up is genuinely excellent (the exact error, both root causes, and the three concrete changes are super clear). Really appreciate it! 🙏

Just one small, optional suggestion to help reviewers and keep things tidy — I haven't changed anything in your description:

Area What could help Suggestion
Linked issue Every PR is expected to be linked to an issue, and the PR title should end with the related (#issue) reference — I couldn't find one here. If a tracking issue exists, add a Closes #<issue> line to the body and append (#<issue>) to the title; if not, opening a quick issue for this fix would satisfy the convention.

💡 If helpful, the contribution conventions and the label/title taxonomy walk through the details.

No rush at all — thanks again for keeping the CI tooling healthy! 🚀

@RomuDeuxfois Romuald Lemesle (RomuDeuxfois) changed the title fix: add missing logic.js and api.js + resolve paths via ACTION_PATH fix: add logic.js and api.js + fix require path resolution Jun 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the move-closed-issue-to-milestone composite action by ensuring its helper modules are present and by making require() resolve relative to the action’s own checkout path (via github.action_path / ACTION_PATH) rather than the caller repository workspace.

Changes:

  • Add/restore the action’s helper modules (logic.js, api.js) used by actions/github-script.
  • Update action.yml to require helpers via process.env.ACTION_PATH.
  • Extend decision logic to skip moving issues already in the target milestone.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
actions/move-closed-issue-to-milestone/action.yml Exposes github.action_path as ACTION_PATH and requires helper modules using that path; passes milestone into decision input.
actions/move-closed-issue-to-milestone/logic.js Implements decide() to determine skip/move based on labels and current milestone.
actions/move-closed-issue-to-milestone/api.js Adds Octokit wrappers to fetch issues, find/create milestones, and set an issue’s milestone.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 10 to +14
function decide({ sourceLabels, targetMilestone, issue }) {
if (!issue) {
return { action: 'skip', reason: 'No issue provided' };
}
const issueLabels = issue.labels || [];
const hasMatchingLabel = issueLabels.some(label => sourceLabels.includes(label));
const issueLabels = (issue.labels || []).map((l) => l.name ?? l);

const hasMatchingLabel = sourceLabels.some((label) => issueLabels.includes(label));

Comment on lines +5 to +8
* @param {string[]} params.sourceLabels - Labels that trigger the move
* @param {string} params.targetMilestone - Name of the target milestone
* @param {object} params.issue - Issue object { number, labels[] }
* @returns {{ action: 'skip'|'move', issueNumber?: number, reason?: string }}
@RomuDeuxfois Romuald Lemesle (RomuDeuxfois) changed the title fix: add logic.js and api.js + fix require path resolution fix: add logic.js and api.js + fix require path resolution (#28) Jun 17, 2026
@RomuDeuxfois
Romuald Lemesle (RomuDeuxfois) merged commit a406ca9 into main Jun 19, 2026
2 of 4 checks passed
@RomuDeuxfois
Romuald Lemesle (RomuDeuxfois) deleted the fix/move-closed-issue-missing-js-files branch June 19, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants