File tree Expand file tree Collapse file tree 4 files changed +34
-8
lines changed
Expand file tree Collapse file tree 4 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 1+ # User lightwight base image
2+ FROM node:20.9.0-alpine
3+
4+ # Install Git
5+ RUN apk add --no-cache git
6+
7+ # Define work directory
8+ WORKDIR /usr/src/app
9+
10+ # Copy package definition
11+ COPY package*.json ./
12+
13+ # Install dependencies
14+ RUN npm install
15+
16+ # Copy source files
17+ COPY . .
18+
19+ # Start backup script
20+ CMD ["node" , "index.js" ]
Original file line number Diff line number Diff line change 1- .PHONY : backup
1+ .PHONY : backup docker_cleanup
22
3- backup : install
4- node index.js
3+ backup : docker_run
54
6- install :
7- npm install
5+ docker_run : docker_build
6+ docker run --rm --name github-backup github-backup
87
8+ docker_build : docker_cleanup
9+ docker build -t github-backup .
10+
11+ docker_cleanup :
12+ docker stop github-backup || true
13+ docker rm github-backup || true
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Local backup of your GitHub data.
1515
1616## Usage
1717
18- Requirements: Node.js
18+ Requirements: Docker
1919
20201 . Clone this repository
21212 . Update and save ` credentials.template.js ` as ` credentials.js `
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import fetch from 'node-fetch'
55import { extension } from 'mime-types'
66import credentials from './credentials.js'
77
8+ shell . config . fatal = true
9+
810const perPage = 100
911const retryCount = 10
1012const retryDelayRateLimit = 6 * 60
@@ -152,8 +154,7 @@ async function backup() {
152154 try {
153155
154156 // Reset the backup folder
155- shell . exec ( `rm -r ${ folder } ` )
156- fs . ensureDirSync ( folder )
157+ fs . emptyDirSync ( folder )
157158
158159 // Get repositories
159160 const repositories = await requestAllWithRetry ( '/user/repos' )
You can’t perform that action at this time.
0 commit comments