ProxmoxVE/.github/workflows/auto-update-app-headers.yml
2025-01-14 14:54:00 +01:00

63 lines
2.0 KiB
YAML

name: Auto Update .app-headers with Hard Merge from Main
on:
push:
branches:
- main
paths:
- 'ct/**.sh'
workflow_dispatch: # Ermöglicht das manuelle Ausführen der Action
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: Create a new branch from main
- name: Create a new branch based on main
run: |
git fetch origin
git checkout main
git pull origin main
BRANCH_NAME="update-app-headers-$(date +'%Y-%m-%d-%H-%M-%S')"
echo "Branch name: $BRANCH_NAME" # Debugging
git checkout -b "$BRANCH_NAME"
echo "Created and switched to branch $BRANCH_NAME"
- name: Install figlet
run: sudo apt-get install -y figlet
# Step 4: Run the generate-app-headers.sh script to update .app-headers
- name: Run generate-app-headers.sh to update .app-headers
run: |
chmod +x .github/workflows/generate-app-headers.sh
.github/workflows/generate-app-headers.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step 5: Push changes to the new branch
- name: Push changes to the new branch
run: |
echo "Pushing changes to branch $BRANCH_NAME" # Debugging
git add ./misc/.app-headers
git commit -m "Update .app-headers file"
git push origin "$BRANCH_NAME"
# Step 6: Delete the created branch locally and remotely after push
- name: Delete the branch after push
run: |
git push origin --delete "$BRANCH_NAME" # Delete remote branch
git checkout main
git branch -D "$BRANCH_NAME" # Delete local branch
echo "Branch $BRANCH_NAME deleted."