-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Add new template and commit PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
solution_name: | ||
description: "The solution name with prefix. (Examples: mpa_ITBase, mpa_Kudos, etc.)" | ||
required: true | ||
default: 'mpa_' | ||
user_name: | ||
description: "User name for the commit" | ||
required: true | ||
default: 'tshanep' | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
check-folder-and-run-actions: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
steps: | ||
# Checkout the main branch | ||
- name: Checkout main branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: 'main' | ||
|
||
# Check if the folder exists | ||
- name: Check for specific folder | ||
id: check_folder | ||
run: | | ||
$folderPath = "solutions/your-specific-folder" | ||
if (Test-Path $folderPath) { | ||
Write-Host "Folder exists." | ||
echo "FOLDER_EXISTS=true" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
} else { | ||
Write-Host "Folder does not exist." | ||
echo "FOLDER_EXISTS=false" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
} | ||
|
||
# Action A: If the folder exists | ||
- name: Action A | ||
if: env.FOLDER_EXISTS == 'true' | ||
run: | | ||
Write-Host "Running Action A because the folder exists." | ||
|
||
# Action B: If the folder does not exist | ||
- name: Action B | ||
if: env.FOLDER_EXISTS == 'false' | ||
run: | | ||
Write-Host "Running Action B because the folder does not exist." |