"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isGitLabRemoteUrl = isGitLabRemoteUrl;
exports.buildGitlabSuperblocksSyncWorkflowFromBaseUrl = buildGitlabSuperblocksSyncWorkflowFromBaseUrl;
const github_workflow_js_1 = require("./github-workflow.js");
function isGitLabRemoteUrl(remoteUrl) {
    return /(^git@gitlab\.com:)|(^https?:\/\/gitlab\.com\/)|(^ssh:\/\/git@gitlab\.com\/)/.test(remoteUrl.trim());
}
function buildGitlabSuperblocksSyncWorkflow(domain = github_workflow_js_1.DEFAULT_SUPERBLOCKS_DOMAIN) {
    return `variables:
  SUPERBLOCKS_DOMAIN: '${domain}'

stages:
  - sync

superblocks-sync:
  stage: sync
  image:
    name: superblocksteam/sync-action:v1
    entrypoint: ['']
    pull_policy: always
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  before_script:
    # Checkout the commit, which triggered the pipeline
    - git checkout "$CI_COMMIT_SHA"
    - git checkout -B "$CI_COMMIT_REF_NAME"
    - git branch --set-upstream-to="origin/$CI_COMMIT_REF_NAME"
  script: /entrypoint.sh
`;
}
function buildGitlabSuperblocksSyncWorkflowFromBaseUrl(superblocksBaseUrl) {
    return buildGitlabSuperblocksSyncWorkflow((0, github_workflow_js_1.getSuperblocksDomainFromBaseUrl)(superblocksBaseUrl));
}
//# sourceMappingURL=gitlab-workflow.js.map