diff --git a/.github/workflows/auto-update-app-headers.yml b/.github/workflows/auto-update-app-headers.yml new file mode 100644 index 00000000..3a67a98b --- /dev/null +++ b/.github/workflows/auto-update-app-headers.yml @@ -0,0 +1,60 @@ +name: Auto Update App Headers + +on: + push: + branches: + - main + paths: + - "ct/**.sh" + - "vm/**.sh" + - "tools/**.sh" + workflow_dispatch: + +jobs: + update-app-headers: + if: github.repository == 'community-scripts/ProxmoxVED' + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Install figlet + run: sudo apt-get install -y figlet + + - name: Generate app headers + run: | + chmod +x .github/workflows/scripts/generate-app-headers.sh + .github/workflows/scripts/generate-app-headers.sh + + - name: Check for changes + id: check_changes + run: | + git add -A + if git diff --cached --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + git diff --stat --cached + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Commit and push changes + if: steps.check_changes.outputs.changed == 'true' + run: | + git commit -m "chore: update app headers [skip ci]" + git push origin main + + - name: No changes detected + if: steps.check_changes.outputs.changed == 'false' + run: echo "No changes to commit. Workflow completed successfully."