Skip to content

Commit

Permalink
⚙️Set up KD-Admin (#265)
Browse files Browse the repository at this point in the history
* Start work for issue #264

* config: set up kdadmin

* config: add line at end

* config: delete unnecessary files

* config: add line at end of file
  • Loading branch information
kselena authored Jun 26, 2024
1 parent e799937 commit 7607298
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 50 deletions.
51 changes: 1 addition & 50 deletions create-pr.ps1
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@
Clear-Host;

Write-Host -NoNewline "Please enter an issue number: " -ForegroundColor Cyan;
$issueNumber = Read-Host;

if ($issueNumber -notmatch '^\d+$') {
Write-Error "User input is not a number";
exit 1;
}

Write-Host -NoNewline "Please enter a branch name: " -ForegroundColor Cyan;
$branchDescrip = Read-Host;

$branchDescrip = $branchDescrip.ToLower();
$branchDescrip = $branchDescrip.Replace(" ", "-").Replace("_", "-");
$branchDescrip = $branchDescrip.TrimStart("-");
$branchDescrip = $branchDescrip.TrimEnd("-");

$headBranch = "feature/$issueNumber-$branchDescrip";
$commitMsg = "Start work for issue #$issueNumber";

$destBranch = "not-set";

$baseBranches = @("main", "preview");
Write-Host -NoNewline "Please choose a base branch from the list [$($baseBranches -join ', ')]: " -ForegroundColor Cyan;
$chosenBaseBranch = Read-Host;

if ($baseBranches -contains $chosenBaseBranch) {
$destBranch = $chosenBaseBranch;
} else {
Write-Error "Invalid base branch.";
exit 1;
}

Write-Host "`n--------------------------------`n";

Write-Host "Creating branch. . ." -ForegroundColor Yellow;
git checkout -B "$headBranch";
Write-Host "";

Write-Host "Creating empty commit. . ." -ForegroundColor Yellow;
git commit --allow-empty -m $commitMsg;
Write-Host "";

Write-Host "Pushing branch to remote. . ." -ForegroundColor Yellow;
git push --set-upstream origin "$headBranch";
Write-Host "";

Write-Host "Creating PR. . ." -ForegroundColor Yellow;
gh pr create -B $destBranch -b "" -t "new pr" -d;
& "dev-tools/bin/kd-admin" create-pr;
3 changes: 3 additions & 0 deletions dev-tools/bin/kd-admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# generated by deno install
deno "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-config" "https://raw.githubusercontent.com/KinsonDigital/kd-admin/v1.0.0-preview.3/src/main.ts" "$@"
2 changes: 2 additions & 0 deletions dev-tools/bin/kd-admin.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
% generated by deno install %
@deno "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-config" "https://raw.githubusercontent.com/KinsonDigital/kd-admin/v1.0.0-preview.3/src/main.ts" %*
7 changes: 7 additions & 0 deletions dev-tools/create-pr-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/create-pr-schema.json",
"ownerName": "KinsonDigital",
"repoName": "VelaptorDocs",
"githubTokenEnvVarName": "CICD_TOKEN",
"baseBranches": [ "main", "preview"]
}

0 comments on commit 7607298

Please sign in to comment.