ProxmoxVE/.github/workflows/auto-update-app-headers.yml

66 lines
2.1 KiB
YAML
Raw Normal View History

name: Auto Update .app-headers with Hard Merge from Main
on:
push:
branches:
- main
paths:
- 'ct/**.sh'
2025-01-14 13:48:47 +00:00
workflow_dispatch: # Ermöglicht das manuelle Ausführen der Action
jobs:
2025-01-14 13:48:47 +00:00
update-app-headers:
runs-on: ubuntu-latest
2025-01-14 13:48:47 +00:00
steps:
2025-01-14 13:48:47 +00:00
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v2
2025-01-14 13:48:47 +00:00
# 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"
2025-01-14 13:48:47 +00:00
# Step 3: Create a new branch from main
- name: Create a new branch based on main
run: |
2025-01-14 13:48:47 +00:00
git fetch origin
git checkout main
git pull origin main
2025-01-14 13:55:18 +00:00
# Feste Branch-Name für Debugging
BRANCH_NAME="update-app-headers-branch"
2025-01-14 13:54:00 +00:00
echo "Branch name: $BRANCH_NAME" # Debugging
2025-01-14 13:55:18 +00:00
2025-01-14 13:48:47 +00:00
git checkout -b "$BRANCH_NAME"
echo "Created and switched to branch $BRANCH_NAME"
2025-01-14 13:51:19 +00:00
- name: Install figlet
run: sudo apt-get install -y figlet
2025-01-14 13:48:47 +00:00
# Step 4: Run the generate-app-headers.sh script to update .app-headers
- name: Run generate-app-headers.sh to update .app-headers
run: |
2025-01-14 13:48:47 +00:00
chmod +x .github/workflows/generate-app-headers.sh
.github/workflows/generate-app-headers.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2025-01-14 13:48:47 +00:00
# Step 5: Push changes to the new branch
- name: Push changes to the new branch
run: |
2025-01-14 13:54:00 +00:00
echo "Pushing changes to branch $BRANCH_NAME" # Debugging
2025-01-14 13:48:47 +00:00
git add ./misc/.app-headers
git commit -m "Update .app-headers file"
git push origin "$BRANCH_NAME"
2025-01-14 13:48:47 +00:00
# Step 6: Delete the created branch locally and remotely after push
- name: Delete the branch after push
run: |
2025-01-14 13:48:47 +00:00
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."