mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-30 12:30:15 +00:00
61 lines
1.9 KiB
YAML
61 lines
1.9 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')"
|
|
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: |
|
|
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."
|