MCPcopy Index your code
hub / github.com/github/docs / main

Function main

script/update-enterprise-dates.js:27–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25main()
26
27async function main() {
28 // send owner, repo, ref, path
29 let rawDates = []
30 try {
31 rawDates = JSON.parse(
32 await getContents('github', 'enterprise-releases', 'master', 'releases.json')
33 )
34 } catch {
35 console.log(
36 'Failed to get the https://github.com/github/enterprise-releases/blob/master/releases.json content. Check that your token has the correct permissions.'
37 )
38 process.exit(1)
39 }
40
41 const formattedDates = {}
42 Object.entries(rawDates).forEach(([releaseNumber, releaseObject]) => {
43 formattedDates[releaseNumber] = {
44 releaseDate: releaseObject.release_candidate || releaseObject.start,
45 deprecationDate: releaseObject.end,
46 }
47 })
48
49 const formattedDatesString = JSON.stringify(formattedDates, null, 2)
50
51 if (formattedDatesString === enterpriseDatesString) {
52 console.log('This repo is already in sync with enterprise-releases!')
53 } else {
54 await fs.writeFile(enterpriseDatesFile, formattedDatesString)
55 console.log(`${enterpriseDatesFile} has been updated!`)
56 }
57}

Callers 1

Calls 1

getContentsFunction · 0.90

Tested by

no test coverage detected