From d027e36a7070b6be87ffebbd1d839e8c269794fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:31:17 +0000 Subject: [PATCH 1/5] Initial plan From 20a7890bf2c3713757c3c44cee8f0d032a1cce24 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:33:11 +0000 Subject: [PATCH 2/5] Convert from CommonJS to ESM importing Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> --- main.js | 16 ++++++++-------- package.json | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index 44f2d593..8146273d 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,11 @@ -const core = require('@actions/core') -const exec = require('@actions/exec') -const github = require('@actions/github') -const artifact = require('@actions/artifact') -const AdmZip = require('adm-zip') -const filesize = require('filesize') -const pathname = require('path') -const fs = require('fs') +import core from '@actions/core' +import exec from '@actions/exec' +import github from '@actions/github' +import artifact from '@actions/artifact' +import AdmZip from 'adm-zip' +import { filesize } from 'filesize' +import pathname from 'path' +import fs from 'fs' async function downloadAction(name, path) { const artifactClient = artifact.create() diff --git a/package.json b/package.json index ae224ed6..b8ebdb30 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "action-download-artifact", + "type": "module", "main": "main.js", "dependencies": { "@actions/artifact": "^6.0.0", From 240889c1465801ed16661eec8e1a3a1a1ec63fab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:35:30 +0000 Subject: [PATCH 3/5] Use node: protocol prefix for built-in modules Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 8146273d..45058156 100644 --- a/main.js +++ b/main.js @@ -4,8 +4,8 @@ import github from '@actions/github' import artifact from '@actions/artifact' import AdmZip from 'adm-zip' import { filesize } from 'filesize' -import pathname from 'path' -import fs from 'fs' +import pathname from 'node:path' +import fs from 'node:fs' async function downloadAction(name, path) { const artifactClient = artifact.create() From 3e1c7405a9fc2d5fc017533115898264b57d119f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:01:06 +0000 Subject: [PATCH 4/5] Fix undeclared variable 'filtered' in ESM strict mode Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 45058156..8dd9a1fc 100644 --- a/main.js +++ b/main.js @@ -213,7 +213,7 @@ async function main() { // One artifact if 'name' input is specified, one or more if `name` is a regular expression, all otherwise. if (name) { - filtered = artifacts.filter((artifact) => { + const filtered = artifacts.filter((artifact) => { if (nameIsRegExp) { return artifact.name.match(name) !== null } From e56b1fd11ddfe25ffcaefd1577e9718364c08a48 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:02:48 +0000 Subject: [PATCH 5/5] Fix filesize function calls for ESM named import Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com> --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 8dd9a1fc..66ebc63a 100644 --- a/main.js +++ b/main.js @@ -241,7 +241,7 @@ async function main() { core.setOutput("found_artifact", true) core.info('==> (found) Artifacts') for (const artifact of artifacts) { - const size = filesize.filesize(artifact.size_in_bytes, { base: 10 }) + const size = filesize(artifact.size_in_bytes, { base: 10 }) core.info(`\t==> Artifact:`) core.info(`\t==> ID: ${artifact.id}`) core.info(`\t==> Name: ${artifact.name}`) @@ -260,7 +260,7 @@ async function main() { for (const artifact of artifacts) { core.info(`==> Artifact: ${artifact.id}`) - const size = filesize.filesize(artifact.size_in_bytes, { base: 10 }) + const size = filesize(artifact.size_in_bytes, { base: 10 }) core.info(`==> Downloading: ${artifact.name}.zip (${size})`)