mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-30 12:30:15 +00:00
Update auto-update-app-headers.yml
This commit is contained in:
parent
647fb1cb5e
commit
434c938cde
52
.github/workflows/auto-update-app-headers.yml
vendored
52
.github/workflows/auto-update-app-headers.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Auto Update .app-headers with Hard Merge from Main
|
name: Auto Update .app-headers
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -6,14 +6,18 @@ on:
|
|||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'ct/**.sh'
|
- 'ct/**.sh'
|
||||||
workflow_dispatch:
|
workflow_dispatch: # Ermöglicht das manuelle Ausführen der Action
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-app-headers:
|
update-app-headers:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Step 1: Checkout the repository
|
# Step 1: Checkout repository
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
@ -35,20 +39,36 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Step 5: Commit the changes directly to main (no temporary branch)
|
# Step 5: Check if there are any changes
|
||||||
- name: Commit changes directly to main
|
- name: Check if there are any changes
|
||||||
|
id: verify-diff
|
||||||
run: |
|
run: |
|
||||||
|
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Step 6: Commit changes (if any) and create a PR
|
||||||
|
- name: Commit and create PR if changes exist
|
||||||
|
if: steps.verify-diff.outputs.changed == 'true'
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add ./misc/.app-headers
|
git add ./misc/.app-headers
|
||||||
git commit -m "Update .app-headers file"
|
git commit -m "Update .app-headers file"
|
||||||
git push origin main
|
# Create a temporary branch for the PR
|
||||||
|
git checkout -b pr-update-app-headers
|
||||||
|
git push origin pr-update-app-headers --force
|
||||||
|
|
||||||
# Step 6: Create Pull Request (PR) to main
|
# Create PR against main
|
||||||
- name: Create Pull Request to main
|
gh pr create --title "[Github Action] Update .app-headers file" \
|
||||||
uses: peter-evans/create-pull-request@v3
|
--body "This PR is auto-generated by a Github Action to update the .app-headers file." \
|
||||||
with:
|
--head pr-update-app-headers \
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
--base main
|
||||||
base: main
|
|
||||||
head: main # Direkt gegen den main Branch
|
- name: Approve pull request
|
||||||
title: "Update .app-headers file"
|
if: steps.verify-diff.outputs.changed == 'true'
|
||||||
body: "Automated PR to update .app-headers file based on script changes."
|
env:
|
||||||
draft: false # Setze auf true, wenn der PR als Draft erstellt werden soll
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
PR_NUMBER=$(gh pr list --head "pr-update-app-headers" --json number --jq '.[].number')
|
||||||
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
|
gh pr review $PR_NUMBER --approve
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user