Skip to content

Commit 3268237

Browse files
committed
action dest folder fix
1 parent 94aa089 commit 3268237

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Diff for: .github/workflows/get-gh-statistics-scheduled.js.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
with:
2727
branch: gh-pages # The branch the action should deploy to.
2828
target-folder: livedata
29-
folder: public/livedata # The folder the action should deploy.
29+
folder: public/livedata-temp # The folder the action should deploy.

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
node_modules
33
/dist
4+
/public/livedata-temp
45

56

67
# local env files

Diff for: src/js/scheduled.mjs

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as fs from 'fs'
77
import * as https from 'https'
88

99
const ghToken = process.env.GH_API_KEY
10+
const destinationFolder = '../../public/livedata-temp' // change "livedata-temp" -> "livedata" to update stuff in local dev env
1011

1112
const functionize = (str) => `/* eslint-disable */ export default () => (${str})`
1213
const request = (url) => {
@@ -51,7 +52,7 @@ const getMilestones = async() => {
5152

5253
const withIssues = await Promise.all([...milestonesOpen, ...milestonesClosed].map(async(milestone) => await getIssues(milestone)))
5354

54-
fs.writeFileSync('../../public/livedata/milestones.js', functionize(JSON.stringify(withIssues)))
55+
fs.writeFileSync(`${destinationFolder}/milestones.js`, functionize(JSON.stringify(withIssues)))
5556
console.log('milestones-file created succesfully!')
5657
} catch (err) {
5758
throw new Error(err)
@@ -77,14 +78,14 @@ const getStars = async() => {
7778
stars: repo.stargazers_count
7879
}))
7980

80-
fs.writeFileSync('../../public/livedata/stars.js', functionize(JSON.stringify(stripped)))
81+
fs.writeFileSync(`${destinationFolder}/stars.js`, functionize(JSON.stringify(stripped)))
8182
console.log('stars-file created succesfully!')
8283
} catch (err) {
8384
throw new Error(err)
8485
}
8586
}
8687

87-
if (!fs.existsSync('../../public/livedata')) fs.mkdirSync('../../public/livedata', { recursive: true }, (err) => { throw new Error(err) })
88+
if (!fs.existsSync(destinationFolder)) fs.mkdirSync(destinationFolder, { recursive: true }, (err) => { throw new Error(err) })
8889
getMilestones()
8990
.then(() => {
9091
getStars()

0 commit comments

Comments
 (0)