mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-10 19:05:09 +00:00
Update generate-app-headers.yaml
This commit is contained in:
parent
8c6f0ac1de
commit
31b253e99f
51
.github/workflows/generate-app-headers.yaml
vendored
51
.github/workflows/generate-app-headers.yaml
vendored
@ -49,9 +49,42 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git merge origin/main --no-edit || echo "No changes to merge from main."
|
git merge origin/main --no-edit || echo "No changes to merge from main."
|
||||||
|
|
||||||
# Step 5: Ensure .app-headers file exists
|
# Step 5: Identify changes in .sh files
|
||||||
- name: Ensure .app-headers file exists
|
- name: Check for .sh files and extract app names
|
||||||
|
id: detect_sh_files
|
||||||
run: |
|
run: |
|
||||||
|
# Get the list of changed files in the PR
|
||||||
|
CHANGED_FILES=$(git diff --name-only HEAD origin/main)
|
||||||
|
|
||||||
|
# Find .sh files and extract app names
|
||||||
|
CHANGED_SH_FILES=$(echo "$CHANGED_FILES" | grep '\.sh$')
|
||||||
|
|
||||||
|
if [ -z "$CHANGED_SH_FILES" ]; then
|
||||||
|
echo "No .sh files changed."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Changed .sh files detected:"
|
||||||
|
echo "$CHANGED_SH_FILES"
|
||||||
|
|
||||||
|
# Extract app names from the file names or content
|
||||||
|
APP_NAMES=""
|
||||||
|
for FILE in $CHANGED_SH_FILES; do
|
||||||
|
# Assuming the app name is part of the file name (e.g., 'appName.sh')
|
||||||
|
APP_NAME=$(basename "$FILE" .sh)
|
||||||
|
APP_NAMES="$APP_NAMES$APP_NAME "
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "App names to process: $APP_NAMES"
|
||||||
|
echo "::set-output name=app_names::$APP_NAMES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 6: Process the app names and update .app-headers
|
||||||
|
- name: Process app names and update .app-headers
|
||||||
|
if: steps.detect_sh_files.outputs.app_names != ''
|
||||||
|
run: |
|
||||||
|
APP_NAMES="${{ steps.detect_sh_files.outputs.app_names }}"
|
||||||
|
|
||||||
|
# Ensure .app-headers file exists
|
||||||
if [ ! -f ".app-headers" ]; then
|
if [ ! -f ".app-headers" ]; then
|
||||||
echo "Creating .app-headers file."
|
echo "Creating .app-headers file."
|
||||||
echo "Generated by CI on $(date)" > .app-headers
|
echo "Generated by CI on $(date)" > .app-headers
|
||||||
@ -59,13 +92,19 @@ jobs:
|
|||||||
echo ".app-headers file already exists."
|
echo ".app-headers file already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 6: Commit and push changes (if any)
|
# For each app name, run figlet and append to .app-headers
|
||||||
|
for APP_NAME in $APP_NAMES; do
|
||||||
|
echo "Processing app: $APP_NAME"
|
||||||
|
echo "$(figlet $APP_NAME)" >> .app-headers
|
||||||
|
done
|
||||||
|
|
||||||
|
# Step 7: Commit and push changes (if any)
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
run: |
|
run: |
|
||||||
git diff --quiet -- .app-headers || git commit -am "[core]: update .app-headers to latest version"
|
git diff --quiet -- .app-headers || git commit -am "[core]: update .app-headers to latest version"
|
||||||
git push origin update-app-headers --force
|
git push origin update-app-headers --force
|
||||||
|
|
||||||
# Step 7: Create Pull Request if changes detected
|
# Step 8: Create Pull Request if changes detected
|
||||||
- name: Create Pull Request if changes detected
|
- name: Create Pull Request if changes detected
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -84,7 +123,7 @@ jobs:
|
|||||||
echo "PR already exists."
|
echo "PR already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 8: Automatically merge PR
|
# Step 9: Automatically merge PR
|
||||||
- name: Automatically merge PR
|
- name: Automatically merge PR
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -99,7 +138,7 @@ jobs:
|
|||||||
echo "No PR found to merge."
|
echo "No PR found to merge."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 9: Final status output
|
# Step 10: Final status output
|
||||||
- name: Output final status
|
- name: Output final status
|
||||||
run: |
|
run: |
|
||||||
echo "Workflow completed successfully. Branch and PR status updated."
|
echo "Workflow completed successfully. Branch and PR status updated."
|
||||||
|
Loading…
Reference in New Issue
Block a user