How to use the azure-devops-node-api.getPersonalAccessTokenHandler function in azure-devops-node-api

To help you get started, we’ve selected a few azure-devops-node-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openupm / openupm / scripts / examples / build-azure-pipelines.js View on Github external
const buildAzurePipelines = async function () {
  let authHandler = azureDevops.getPersonalAccessTokenHandler(config.azureDevops.token);
  let conn = new azureDevops.WebApi(config.azureDevops.endpoint, authHandler);
  var buildApi = await conn.getBuildApi();
  let build = await buildApi.queueBuild({
    definition: {
      id: config.azureDevops.definitionId,
    },
    parameters:
      JSON.stringify(
        {
          repo_url: 'https://github.com/rotorz/unity3d-localized-strings.git',
          repo_branch: 'v1.0.3',
          package_name: '@rotorz/unity3d-localized-strings',
          package_ver: '1.0.3',
          build_name: getBuildName('x', '@rotorz/unity3d-localized-strings', '1.0.3'),
          // 'system.debug': true,
          // 'agent.diagnostic': true,
github microsoft / azure-pipelines-agent / release / createAdoPrs.js View on Github external
const INTEGRATION_DIR = path.join(__dirname, '..', '_layout', 'integrations');
const GIT = 'git';

var opt = require('node-getopt').create([
    ['',  'dryrun',               'Dry run only, do not actually commit new release'],
    ['h', 'help',                 'Display this help'],
  ])
  .setHelp(
    'Usage: node createAdoPrs.js [OPTION] \n' +
    '\n' +
    '[[OPTIONS]]\n'
  )
  .bindHelp()     // bind option 'help' to default action
  .parseSystem(); // parse command line

const authHandler = azdev.getPersonalAccessTokenHandler(process.env.PAT);
const connection = new azdev.WebApi('https://dev.azure.com/mseng', authHandler);

function createIntegrationFiles(newRelease, callback)
{
    fs.mkdirSync(INTEGRATION_DIR, { recursive: true });
    fs.readdirSync(INTEGRATION_DIR).forEach( function(entry) {
        if (entry.startsWith('PublishVSTSAgent-'))
        {
            // node 12 has recursive support in rmdirSync
            // but since most of us are still on node 10
            // remove the files manually first
            var dirToDelete = path.join(INTEGRATION_DIR, entry);
            fs.readdirSync(dirToDelete).forEach( function(file) {
                fs.unlinkSync(path.join(dirToDelete, file));
            });
            fs.rmdirSync(dirToDelete, { recursive: true });
github microsoft / azure-pipelines-agent / release / createAdoPr.js View on Github external
const INTEGRATION_DIR = path.join(__dirname, '..', '_layout', 'integrations');
const GIT = 'git';

var opt = require('node-getopt').create([
    ['',  'dryrun',               'Dry run only, do not actually commit new release'],
    ['h', 'help',                 'Display this help'],
  ])
  .setHelp(
    'Usage: node createAdoPr.js [OPTION] \n' +
    '\n' +
    '[[OPTIONS]]\n'
  )
  .bindHelp()     // bind option 'help' to default action
  .parseSystem(); // parse command line

const authHandler = azdev.getPersonalAccessTokenHandler(process.env.PAT);
const connection = new azdev.WebApi('https://dev.azure.com/mseng', authHandler);

function createIntegrationFiles(newRelease, callback)
{
    fs.mkdirSync(INTEGRATION_DIR, { recursive: true });
    util.versionifySync(path.join(__dirname, '..', 'src', 'Misc', 'InstallAgentPackage.template.xml'),
        path.join(INTEGRATION_DIR, 'InstallAgentPackage.xml'),
        newRelease
    );
}

commitAndPush = function(directory, release, branch)
{
    util.execInForeground(`${GIT} checkout -b ${branch}`, directory);
    util.execInForeground(`${GIT} commit -m "Agent Release ${release}" `, directory);
    util.execInForeground(`${GIT} push --set-upstream origin ${branch}`, directory);
github microsoft / azure-pipelines-tasks / ci / file-bugs.js View on Github external
async function getNodeApi() {
    let authHandler = azdev.getPersonalAccessTokenHandler(azpPAT); 
    let connection = new azdev.WebApi('https://dev.azure.com/mseng', authHandler);  
    return await connection.getWorkItemTrackingApi();
}
github openupm / openupm / scripts / jobs / build-release.js View on Github external
async getBuildApi() {
    let authHandler = azureDevops.getPersonalAccessTokenHandler(config.azureDevops.token);
    let conn = new azureDevops.WebApi(config.azureDevops.endpoint, authHandler);
    let buildApi = await conn.getBuildApi();
    return buildApi;
  }
}
github openupm / openupm / app / utils / azure.js View on Github external
const getBuildApi = async function() {
  let authHandler = azureDevops.getPersonalAccessTokenHandler(
    config.azureDevops.token
  );
  let conn = new azureDevops.WebApi(config.azureDevops.endpoint, authHandler);
  let buildApi = await conn.getBuildApi();
  return buildApi;
};