MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getEnvs

Function getEnvs

cypress/plugins/bitbucket.js:29–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27};
28
29async function getEnvs() {
30 const {
31 BITBUCKET_REPO_OWNER: owner,
32 BITBUCKET_REPO_NAME: repo,
33 BITBUCKET_OUATH_CONSUMER_KEY: consumerKey,
34 BITBUCKET_OUATH_CONSUMER_SECRET: consumerSecret,
35 } = process.env;
36 if (!owner || !repo || !consumerKey || !consumerSecret) {
37 throw new Error(
38 'Please set BITBUCKET_REPO_OWNER, BITBUCKET_REPO_NAME, BITBUCKET_OUATH_CONSUMER_KEY, BITBUCKET_OUATH_CONSUMER_SECRET environment variables',
39 );
40 }
41
42 const params = new URLSearchParams();
43 params.append('grant_type', 'client_credentials');
44
45 const {
46 access_token: token,
47 } = await fetch(
48 `https://${consumerKey}:${consumerSecret}@bitbucket.org/site/oauth2/access_token`,
49 { method: 'POST', body: params },
50 ).then(r => r.json());
51
52 return { owner, repo, token };
53}
54
55const API_URL = 'https://api.bitbucket.org/2.0/';
56

Callers 5

prepareTestBitBucketRepoFunction · 0.70
getUserFunction · 0.70
deleteRepositoriesFunction · 0.70
resetOriginRepoFunction · 0.70
teardownBitBucketTestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected