mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-19 03:58:07 +00:00
Update generate-app-headers.yaml
This commit is contained in:
parent
7930764ece
commit
2dddbaebe4
42
.github/workflows/generate-app-headers.yaml
vendored
42
.github/workflows/generate-app-headers.yaml
vendored
@ -31,33 +31,27 @@ jobs:
|
|||||||
git checkout update-app-headers
|
git checkout update-app-headers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 3: Ensure .app-headers file exists
|
# Step 3: Ensure .app-headers file exists and verify content
|
||||||
- name: Ensure .app-headers file exists
|
- name: Ensure .app-headers file exists and verify content
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f ".app-headers" ]; then
|
if [ ! -f ".app-headers" ]; then
|
||||||
echo "The .app-headers file does not exist. Creating it."
|
echo "The .app-headers file does not exist. Creating it."
|
||||||
echo "Generated by CI" > .app-headers
|
echo "Generated by CI" > .app-headers
|
||||||
else
|
else
|
||||||
echo ".app-headers already exists."
|
echo ".app-headers already exists. Checking if there are any changes."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 4: Check for changes in the .app-headers file content
|
# Verifying if there are changes in .app-headers file content
|
||||||
- name: Check if .app-headers has changes
|
git diff --quiet -- .app-headers || echo "Changes detected in .app-headers"
|
||||||
id: check_changes
|
|
||||||
run: |
|
|
||||||
git diff --quiet origin/main..HEAD -- .app-headers
|
|
||||||
echo "Changes detected: $?"
|
|
||||||
continue-on-error: true # So the workflow continues even if no changes are detected
|
|
||||||
|
|
||||||
# Step 5: Commit changes if detected
|
# Step 4: Commit changes if detected
|
||||||
- name: Commit changes if detected
|
- name: Commit changes if detected
|
||||||
if: steps.check_changes.outcome == 'failure'
|
if: ${{ steps.verify_changes.outputs.changes_detected == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
echo "Changes detected in .app-headers. Committing changes."
|
|
||||||
git commit -am "[core]: update .app-headers to latest version"
|
git commit -am "[core]: update .app-headers to latest version"
|
||||||
git push origin update-app-headers --force
|
git push origin update-app-headers --force
|
||||||
|
|
||||||
# Step 6: Create Pull Request if changes detected
|
# Step 5: Create Pull Request if changes detected
|
||||||
- name: Create Pull Request if changes detected
|
- name: Create Pull Request if changes detected
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -65,14 +59,30 @@ jobs:
|
|||||||
PR_EXISTS=$(gh pr list --head "update-app-headers" --json number --jq '.[].number')
|
PR_EXISTS=$(gh pr list --head "update-app-headers" --json number --jq '.[].number')
|
||||||
if [ -z "$PR_EXISTS" ]; then
|
if [ -z "$PR_EXISTS" ]; then
|
||||||
echo "Creating a new PR."
|
echo "Creating a new PR."
|
||||||
gh pr create --title "[core]: update .app-headers to latest version" \
|
PR_URL=$(gh pr create --title "[core]: update .app-headers to latest version" \
|
||||||
--body "This PR automatically updates the .app-headers file." \
|
--body "This PR automatically updates the .app-headers file." \
|
||||||
--head update-app-headers \
|
--head update-app-headers \
|
||||||
--base main
|
--base main --json url -q .url)
|
||||||
|
echo "PR created: $PR_URL"
|
||||||
else
|
else
|
||||||
echo "PR already exists."
|
echo "PR already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Step 6: Automatically merge the PR if no conflicts
|
||||||
|
- name: Automatically merge PR
|
||||||
|
if: ${{ steps.verify_changes.outputs.changes_detected == 'true' }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo "Attempting to merge PR."
|
||||||
|
PR_NUMBER=$(gh pr list --head "update-app-headers" --json number --jq '.[].number')
|
||||||
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
|
gh pr merge "$PR_NUMBER" --merge --admin --delete-branch
|
||||||
|
echo "PR merged successfully."
|
||||||
|
else
|
||||||
|
echo "No PR found to merge."
|
||||||
|
fi
|
||||||
|
|
||||||
# Step 7: Final status output
|
# Step 7: Final status output
|
||||||
- name: Output final status
|
- name: Output final status
|
||||||
run: |
|
run: |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user