"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAzureDevOpsRemoteUrl = isAzureDevOpsRemoteUrl;
exports.buildAzureDevOpsSuperblocksSyncPipeline = buildAzureDevOpsSuperblocksSyncPipeline;
exports.buildAzureDevOpsSuperblocksSyncPipelineFromBaseUrl = buildAzureDevOpsSuperblocksSyncPipelineFromBaseUrl;
const github_workflow_js_1 = require("./github-workflow.js");
function isAzureDevOpsRemoteUrl(remoteUrl) {
    return /(^git@ssh\.dev\.azure\.com:)|(^https?:\/\/([^@]+@)?dev\.azure\.com\/)|(^ssh:\/\/git@ssh\.dev\.azure\.com\/)/.test(remoteUrl.trim());
}
function buildAzureDevOpsSuperblocksSyncPipeline(domain = github_workflow_js_1.DEFAULT_SUPERBLOCKS_DOMAIN) {
    (0, github_workflow_js_1.assertValidDomain)(domain);
    return `trigger:
  branches:
    include:
      - main

pool:
  vmImage: ubuntu-latest

variables:
  SUPERBLOCKS_DOMAIN: '${domain}'

steps:
  - checkout: self
    fetchDepth: 0
    persistCredentials: false

  - task: Bash@3
    displayName: Sync to Superblocks
    env:
      SUPERBLOCKS_TOKEN: $(SUPERBLOCKS_TOKEN)
      SUPERBLOCKS_DOMAIN: $(SUPERBLOCKS_DOMAIN)
    inputs:
      targetType: inline
      script: |
        docker run --rm \\
          -e SUPERBLOCKS_TOKEN \\
          -e SUPERBLOCKS_DOMAIN \\
          -v "$BUILD_SOURCESDIRECTORY:/github/workspace" \\
          -w /github/workspace \\
          superblocksteam/sync-action:v1
`;
}
function buildAzureDevOpsSuperblocksSyncPipelineFromBaseUrl(superblocksBaseUrl) {
    return buildAzureDevOpsSuperblocksSyncPipeline((0, github_workflow_js_1.getSuperblocksDomainFromBaseUrl)(superblocksBaseUrl));
}
//# sourceMappingURL=azure-devops-workflow.js.map