Skip to content

Sa 3607 gha ci workflow km #82

Sa 3607 gha ci workflow km

Sa 3607 gha ci workflow km #82

name: PowerShell Module CI
on:
pull_request:
branches:
- 'JumpCloudModule_**'
jobs:
check-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check Changes in Folder
run: |
# Define the path to the specific folder you want to check
SPECIFIC_FOLDER="/PowerShell/ModuleChangelog.md"
# Check for changes in the specific folder
git fetch origin $GITHUB_BASE_REF
CHANGED_FILES=$(git diff origin/$GITHUB_BASE_REF..HEAD)
# If there are changes in the specific folder, exit with 0
if echo "$CHANGED_FILES" | grep "$SPECIFIC_FOLDER"; then
echo "Changes detected in $SPECIFIC_FOLDER"
exit 1
else
echo "No changes detected in $SPECIFIC_FOLDER"
# exit GH Action with error code
exit 1
fi
# Create a job to check if recent job has failed then exit all GH Actions
check-failed-job:
runs-on: ubuntu-latest
needs: check-changes
if: ${{ failure() }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Exit with error code
run: exit 1
clone:
needs: check-failed-job
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
Publish-PowerShell-Artifact:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
Source: "CodeArtifact"
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
PowerShell
- shell: pwsh
run: |
. "./PowerShell/Deploy/BuildNuspecFromPsd1.ps1" -RequiredModulesRepo PSGallery