mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-02 00:31:51 +00:00
Update and rename App_Header_Merge_Into_main.yaml to auto-update-app-headers.yml
This commit is contained in:
parent
3830527ef2
commit
692f3caab6
@ -1,66 +0,0 @@
|
|||||||
name: Auto Update .app-headers and Create PR
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'ct/**.sh'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-app-headers:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Step 1: Checkout the repository
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
# Step 2: Set up Git user for committing changes
|
|
||||||
- name: Set up Git
|
|
||||||
run: |
|
|
||||||
git config --global user.name "GitHub Actions"
|
|
||||||
git config --global user.email "actions@github.com"
|
|
||||||
|
|
||||||
# Step 3: Ensure .app-headers file exists
|
|
||||||
- name: Ensure .app-headers file exists
|
|
||||||
run: |
|
|
||||||
if [ ! -f ct/.app-headers ]; then
|
|
||||||
echo "Creating .app-headers file."
|
|
||||||
touch ct/.app-headers
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 4: Process the ct/*.sh files and update .app-headers
|
|
||||||
- name: Update .app-headers with figlet output
|
|
||||||
run: |
|
|
||||||
echo "Updating .app-headers with figlet output."
|
|
||||||
for script in ct/*.sh; do
|
|
||||||
if grep -q 'APP=' "$script"; then
|
|
||||||
APP_NAME=$(grep -oP 'APP=\K\w+' "$script")
|
|
||||||
echo "Processing $script for APP: \"$APP_NAME\""
|
|
||||||
figlet "$APP_NAME" >> ct/.app-headers
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Step 5: Check out and merge main into the update-app-headers branch without committing
|
|
||||||
- name: Merge main into update-app-headers
|
|
||||||
run: |
|
|
||||||
git fetch origin
|
|
||||||
git checkout update-app-headers
|
|
||||||
git merge origin/main --no-ff --no-commit -m "Merge main into update-app-headers"
|
|
||||||
echo "Merge complete. Please review and commit the changes manually."
|
|
||||||
|
|
||||||
# Step 6: Check if a PR exists and create one if it doesn't
|
|
||||||
- name: Create Pull Request if not exists
|
|
||||||
run: |
|
|
||||||
PR_EXISTS=$(gh pr list --head "update-app-headers" --json number --jq '.[].number')
|
|
||||||
|
|
||||||
if [ -z "$PR_EXISTS" ]; then
|
|
||||||
echo "Creating a new PR."
|
|
||||||
PR_URL=$(gh pr create --title "[core]: update .app-headers to latest version" \
|
|
||||||
--body "This PR automatically updates the .app-headers file." \
|
|
||||||
--head update-app-headers \
|
|
||||||
--base main)
|
|
||||||
echo "PR created: $PR_URL"
|
|
||||||
else
|
|
||||||
echo "PR already exists."
|
|
||||||
fi
|
|
63
.github/workflows/auto-update-app-headers.yml
vendored
Normal file
63
.github/workflows/auto-update-app-headers.yml
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
name: Auto Update .app-headers with Hard Merge from Main
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'ct/**.sh'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto-update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Step 1: Checkout repository
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Step 2: Set up Git user
|
||||||
|
- name: Set up Git
|
||||||
|
run: |
|
||||||
|
git config --global user.name "GitHub Actions"
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
|
||||||
|
# Step 3: Reset update-app-headers to main
|
||||||
|
- name: Reset update-app-headers branch to main
|
||||||
|
run: |
|
||||||
|
git checkout -B update-app-headers origin/main
|
||||||
|
echo "Branch update-app-headers reset to match main"
|
||||||
|
|
||||||
|
# Step 4: Ensure .app-headers file exists
|
||||||
|
- name: Ensure .app-headers file exists
|
||||||
|
run: |
|
||||||
|
touch ct/.app-headers
|
||||||
|
|
||||||
|
# Step 5: Update .app-headers with figlet output
|
||||||
|
- name: Update .app-headers
|
||||||
|
run: |
|
||||||
|
output_file="./ct/.app-headers"
|
||||||
|
> "$output_file" # Clear or create the file
|
||||||
|
|
||||||
|
current_date=$(date +"%m-%d-%Y")
|
||||||
|
echo "### Generated on $current_date" >> "$output_file"
|
||||||
|
echo "##################################################" >> "$output_file"
|
||||||
|
echo >> "$output_file"
|
||||||
|
|
||||||
|
find ./ct -type f -name "*.sh" | sort | while read -r script; do
|
||||||
|
app_name=$(grep -oP '^APP="\K[^"]+' "$script" 2>/dev/null)
|
||||||
|
|
||||||
|
if [[ -n "$app_name" ]]; then
|
||||||
|
figlet_output=$(figlet -f slant "$app_name" 2>/dev/null || echo "FIGLET ERROR: $app_name")
|
||||||
|
echo "### $(basename "$script")" >> "$output_file"
|
||||||
|
echo "APP=$app_name" >> "$output_file"
|
||||||
|
echo "$figlet_output" >> "$output_file"
|
||||||
|
echo >> "$output_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Step 6: Commit and push changes
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git add ct/.app-headers
|
||||||
|
git commit -m "Update .app-headers on $(date +"%Y-%m-%d")" || echo "No changes to commit"
|
||||||
|
git push --force origin update-app-headers
|
Loading…
x
Reference in New Issue
Block a user