Skip to content

Commit 01a266f

Browse files
committed
Support ENV for PAT now
1 parent 15f51ca commit 01a266f

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
node_modules
2-
config.json
1+
node_modules

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

config.json.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"cloudflare": "ghp_bFLPOxxxxxxxxxxxxxxxxxxxxxxx",
2+
"knatnetwork": "ghp_bFLPOxxxxxxxxxxxxxxxxxxxxxxx",
33
"rust-lang": "ghp_JGIGxxxxxxxxxxxxxxxxxxxOij4"
44
}

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ const axios = require('axios');
44
const org_pat_map = require('./config.json')
55
const port = 3000
66

7+
const env_list = process.env
8+
for(var i in env_list) {
9+
if(i.includes('PAT_')){
10+
org_pat_map[i.replace('PAT_', '')] = env_list[i]
11+
}
12+
}
13+
714
app.get('/repo/:github_repo_owner/:github_repo_name/registration-token', (req, res) => {
815
const registration_token_url= `https://api.github.com/repos/${req.params.github_repo_owner}/${req.params.github_repo_name}/actions/runners/registration-token`
916
const github_pat = org_pat_map[`${req.params.github_repo_owner}`]

0 commit comments

Comments
 (0)