File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1616 uses : actions/github-script@v6
1717 with :
1818 script : |
19+ const fetch = require('node-fetch');
20+
1921 async function fetchAndCountData(url) {
2022 const counts = {
2123 templates: 0,
@@ -30,13 +32,13 @@ jobs:
3032 do {
3133 try {
3234 // Construct the URL with cursor if available
33- const fetchUrl = cursor ? ${url}?cursor=${encodeURIComponent(cursor)} : url;
35+ const fetchUrl = cursor ? ` ${url}?cursor=${encodeURIComponent(cursor)}` : url;
3436
3537 // Fetch the data from the API
3638 const response = await fetch(fetchUrl);
3739
3840 if (!response.ok) {
39- throw new Error(HTTP error! status: ${response.status});
41+ throw new Error(` HTTP error! status: ${response.status}` );
4042 }
4143
4244 const responseData = await response.json();
6466 // Update the cursor for the next page
6567 cursor = responseData.nextCursor || null;
6668 } catch (error) {
67- core.setFailed( Error fetching data: ${error.message});
69+ console.error(` Error fetching data: ${error.message}` );
6870 cursor = null; // Exit the loop on error
6971 }
7072 } while (cursor);
8284 const url = "https://pkg.pr.new/stats";
8385 const counts = await fetchAndCountData(url);
8486
85- console.log("Counts:", counts);
87+ console.log("Counts:", counts);
You can’t perform that action at this time.
0 commit comments