GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — github-docs/script/update-enterprise-dates.js at main · 0xdevalias/github-docs

Expand file tree

/

update-enterprise-dates.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
44 lines (36 loc) · 1.45 KB
/

update-enterprise-dates.js

Copy path

File metadata and controls

executable file
·
44 lines (36 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
const { getContents } = require('./helpers/git-utils')
const fs = require('fs')
const path = require('path')
const enterpriseDatesFile = path.join(__dirname, '../lib/enterprise-dates.json')
const enterpriseDatesString = fs.readFileSync(enterpriseDatesFile, 'utf8')
// [start-readme]
//
// This script fetches data from https://github.com/github/enterprise-releases/blob/master/releases.json
// and updates `lib/enterprise-dates.json`, which the site uses for various functionality.
//
// [end-readme]
// check for required PAT
if (!process.env.GITHUB_TOKEN) {
console.error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.')
process.exit(1)
}
main()
async function main () {
// send owner, repo, ref, path
const rawDates = JSON.parse(await getContents('github', 'enterprise-releases', 'master', 'releases.json'))
const formattedDates = {}
Object.entries(rawDates).forEach(([releaseNumber, releaseObject]) => {
formattedDates[releaseNumber] = {
releaseDate: releaseObject.release_candidate || releaseObject.start,
deprecationDate: releaseObject.end
}
})
const formattedDatesString = JSON.stringify(formattedDates, null, 2)
if (formattedDatesString === enterpriseDatesString) {
console.log('This repo is already in sync with enterprise-releases!')
} else {
fs.writeFileSync(enterpriseDatesFile, formattedDatesString)
console.log(`${enterpriseDatesFile} has been updated!`)
}
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.