Skip to content

Instantly share code, notes, and snippets.

@iamstarkov
Created January 24, 2018 12:02
Show Gist options
  • Save iamstarkov/725d20bc5fbf402b785eba06ff9c04c1 to your computer and use it in GitHub Desktop.
Save iamstarkov/725d20bc5fbf402b785eba06ff9c04c1 to your computer and use it in GitHub Desktop.
const api = require('./bb-got');
const R = require('./nanoramda');
const fn = p => p
.then(R.prop('body'))
// .then(R.prop('id'))
.then(R.debug)
.catch(R.err);
const opts = { headers: { Authorization: `Basic ${process.env.BB_TOKEN}` }};
const config = {
// repoName: 'FilipStenbeck1/testing',
repoName: 'iamstarkov/nordnet-ui-kit',
}
const prNo = 3;
const branchName = 'master';
const filePath = 'README.md';
const FormData = require('form-data');
const form = new FormData();
form.append('message', 'CLI COMMIT MOVE ALONG, NOTHING TO SEE HERE');
form.append('parents', '4c19bab47b9f176ac3d3f775b95cc6174a619a02');
form.append('branch', 'CLI-CREATED-BRANCH-7');
form.append('/README.md', `test thingy`);
form.append('/README yolo.md', `yolo`);
// message: 'CLI COMMIT MOVE ALONG, NOTHING TO SEE HERE',
// parents: '4c19bab47b9f176ac3d3f775b95cc6174a619a02',
// files: [
// `/README.md='yolo'`
// // `/README2.md='yolo2'`
// // `/README2.md='yolo2'`
// ],
// branch: 'CLI-CREATED-BRANCH-2',
fn(
// api.get(`/2.0/repositories/iamstarkov/nordnet-ui-kit`, opts),
// api.get(`/2.0/repositories/FilipStenbeck1/testing/pullrequests/1`, opts)
// api.get(`/2.0/repositories/${config.repoName}/pullrequests/${prNo}/diff`, { ...opts, json: false })
/*
api.post(`/2.0/repositories/${config.repoName}/pullrequests/${prNo}/merge`, {
...opts,
token: undefined,
body: {
close_source_branch: true,
merge_strategy: 'merge_commit',
message: 'auto merged',
}
})
*/
// api.get(`/2.0/repositories/${config.repoName}/src/${branchName}/${filePath}`, { json: false }),
// api.post(`/2.0/repositories/${config.repoName}/src`, { ...opts, json: false, body: form })
api.get(
`/2.0/repositories/${config.repoName}/refs/branches/${branchName}`
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment