1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-02-02 00:31:51 +00:00
ProxmoxVE/.github/workflows/auto-update-app-headers.yml

80 lines
2.5 KiB
YAML
Raw Normal View History

name: Auto Update .app-files
on:
push:
branches:
- main
paths:
- 'ct/**.sh'
2025-01-24 14:50:48 +01:00
workflow_dispatch:
jobs:
update-app-files:
runs-on: ubuntu-latest
2025-01-14 14:48:47 +01:00
2025-01-14 15:01:05 +01:00
permissions:
contents: write
pull-requests: write
steps:
2025-01-24 14:48:15 +01:00
# Step 1: Checkout repository
- name: Checkout repository
uses: actions/checkout@v2
2025-01-24 14:18:39 +01:00
# Step 2: Disable file mode changes detection
- name: Disable file mode changes
run: git config core.fileMode false
# Step 3: Set up Git user for committing changes
- name: Set up Git
run: |
git config --global user.name "GitHub Actions"
2025-01-24 14:11:39 +01:00
git config --global user.email "github-actions[bot]@users.noreply.github.com"
2025-01-24 14:18:39 +01:00
# Step 4: Install figlet
2025-01-14 14:51:19 +01:00
- name: Install figlet
run: sudo apt-get install -y figlet
2025-01-14 14:48:47 +01:00
2025-01-24 14:18:39 +01:00
# Step 5: Run the updated generate-app-files.sh script
- name: Run generate-app-files.sh
run: |
chmod +x .github/workflows/scripts/generate-app-headers.sh
.github/workflows/scripts/generate-app-headers.sh
2025-01-14 14:48:47 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2025-01-24 14:18:39 +01:00
# Step 6: Check if there are any changes
2025-01-14 15:01:05 +01:00
- name: Check if there are any changes
run: |
2025-01-24 14:50:48 +01:00
echo "Checking for changes..."
2025-01-28 13:10:03 +01:00
git add -A # Untracked Dateien aufnehmen
2025-01-24 14:50:48 +01:00
git status
2025-01-28 13:10:03 +01:00
if git diff --cached --quiet; then
2025-01-24 14:09:09 +01:00
echo "No changes detected."
2025-01-28 13:10:03 +01:00
echo "changed=false" >> "$GITHUB_ENV"
2025-01-24 14:09:09 +01:00
else
2025-01-24 14:50:48 +01:00
echo "Changes detected:"
2025-01-28 13:10:03 +01:00
git diff --stat --cached
echo "changed=true" >> "$GITHUB_ENV"
2025-01-24 14:09:09 +01:00
fi
2025-01-14 15:01:05 +01:00
2025-01-28 13:10:03 +01:00
# Step 7: Commit and create PR if changes exist
2025-01-14 15:01:05 +01:00
- name: Commit and create PR if changes exist
2025-01-28 13:10:03 +01:00
if: env.changed == 'true'
run: |
git commit -m "Update .app files"
git checkout -b pr-update-app-files
git push origin pr-update-app-files --force
gh pr create --title "[core] update .app files" \
2025-01-24 14:11:39 +01:00
--body "This PR is auto-generated by a GitHub Action to update the .app files." \
--head pr-update-app-files \
2025-01-14 15:03:00 +01:00
--base main \
--label "automated pr"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2025-01-14 15:01:05 +01:00
2025-01-24 14:18:39 +01:00
# Step 8: Output success message when no changes
2025-01-24 14:09:09 +01:00
- name: No changes detected
2025-01-28 13:10:03 +01:00
if: env.changed == 'false'
2025-01-24 14:09:09 +01:00
run: echo "No changes to commit. Workflow completed successfully."