Skip to content

Commit

Permalink
feat: allow GitHub OAuth scheme authentication
Browse files Browse the repository at this point in the history
Resolves #17
  • Loading branch information
marceloavf committed Jul 9, 2018
1 parent eb9ae77 commit 893215d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Src/GithubReleasePublish/githubReleasePublish.js
Expand Up @@ -3,15 +3,15 @@ import bytesToSize from 'CommonNode/bytesToSize.js'
import objectDifference from 'CommonNode/objectDifference.js'

let editObject
let githubEndpointToken

const glob = require('glob')
const publishRelease = require('publish-release')
const tl = require('vsts-task-lib/task')

/** Endpoint */
const githubEndpoint = tl.getInput('githubEndpoint')
const githubEndpointToken = tl.getEndpointAuthorization(githubEndpoint)
.parameters.accessToken
const githubEndpointObject = tl.getEndpointAuthorization(githubEndpoint)

/** Inputs */
const githubRepository = tl.getInput('githubRepository')
Expand Down Expand Up @@ -43,6 +43,17 @@ let githubReleaseAsset = tl.getPathInput('githubReleaseAsset')
/** Check for options in manifest if they don't exists on input */
const manifestOptions = readManifest(manifestJson)

/**
* Get specific token, either OAuth or Personal Access Token
* WARNING: AccessToken first letter change depending on scheme
*/
if (githubEndpointObject.scheme === 'PersonalAccessToken') {
githubEndpointToken = githubEndpointObject.parameters.accessToken
} else {
// scheme: 'OAuth'
githubEndpointToken = githubEndpointObject.parameters.AccessToken
}

/** Check for one or multiples files into array
* Accept wildcards to look for files
*/
Expand Down

0 comments on commit 893215d

Please sign in to comment.