@@ -54,52 +54,61 @@ jobs:
5454 // run, and not from pull requests)
5555 async function lastArtifactByName(name) {
5656 try {
57- const response = await github.rest.actions.listArtifactsForRepo({
58- owner: context.repo.owner,
59- repo: context.repo.repo,
60- name: name,
61- page: 1,
62- per_page: 1
57+ const response =
58+ await github.rest.actions.listArtifactsForRepo({
59+ owner: context.repo.owner,
60+ repo: context.repo.repo,
61+ name: name,
62+ page: 1,
63+ per_page: 1
6364 });
64- if (response.data.artifacts && response.data.artifacts.length > 0) {
65+ if (response.data.artifacts &&
66+ response.data.artifacts.length > 0) {
6567 return response.data.artifacts[0];
6668 } else {
6769 console.log(`Artifact with name ${name} not found`);
6870 }
6971 } catch (error) {
70- console.error(`Error listing artifact with name ${name}:`, error);
72+ console.error(`Error listing artifact name ${name}:`,
73+ error);
7174 throw error;
7275 }
7376 }
7477
7578 // helper to download an artifact by id and save it into filePath
7679 async function downloadArtifact(artifactId, filePath) {
7780 try {
78- const response = await github.rest.actions.downloadArtifact({
79- owner: context.repo.owner,
80- repo: context.repo.repo,
81- artifact_id: artifactId,
82- archive_format: 'zip'
81+ const response =
82+ await github.rest.actions.downloadArtifact({
83+ owner: context.repo.owner,
84+ repo: context.repo.repo,
85+ artifact_id: artifactId,
86+ archive_format: 'zip'
8387 });
8488 fs.writeFileSync(filePath, Buffer.from(response.data));
8589 console.log(`Artifact saved to ${filePath}`);
8690 } catch (error) {
87- console.error(`Error downloading artifact with ID ${artifactId}:`, error);
91+ console.error(`Error downloading artifact ${artifactId}:`,
92+ error);
8893 throw error;
8994 }
9095 }
9196
9297 try {
93- let linux_deb_artifact = await lastArtifactByName("linux-deb-links");
94- let u_boot_rb1_artifact = await lastArtifactByName("u-boot-rb1-links");
98+ let linux_deb_artifact =
99+ await lastArtifactByName("linux-deb-links");
100+ let u_boot_rb1_artifact =
101+ await lastArtifactByName("u-boot-rb1-links");
95102
96103 if (!linux_deb_artifact || !u_boot_rb1_artifact) {
97104 console.error('One or both artifacts are missing');
98105 process.exit(1);
99106 }
100107
101- await downloadArtifact(owner, repo, linux_deb_artifact_id, 'linux-deb-links.zip');
102- await downloadArtifact(owner, repo, u_boot_rb1_artifact_id, 'u-boot-rb1-links.zip');
108+ await downloadArtifact(linux_deb_artifact_id,
109+ 'linux-deb-links.zip');
110+ await downloadArtifact(u_boot_rb1_artifact_id,
111+ 'u-boot-rb1-links.zip');
103112 } catch (error) {
104113 console.error('Error retrieving artifacts: ', error);
105114 process.exit(1);
0 commit comments