mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-25 01:13:40 +00:00
Update auto-update-app-headers.yml
This commit is contained in:
parent
1c008a1742
commit
f23da27ba2
18
.github/workflows/auto-update-app-headers.yml
vendored
18
.github/workflows/auto-update-app-headers.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
- name: Set up Git
|
- name: Set up Git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "GitHub Actions"
|
git config --global user.name "GitHub Actions"
|
||||||
git config --global user.email "actions@github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
# Step 3: Install figlet
|
# Step 3: Install figlet
|
||||||
- name: Install figlet
|
- name: Install figlet
|
||||||
@ -55,17 +55,13 @@ jobs:
|
|||||||
- name: Commit and create PR if changes exist
|
- name: Commit and create PR if changes exist
|
||||||
if: steps.verify-diff.outputs.changed == 'true'
|
if: steps.verify-diff.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git add -A
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add ./ct/*.app
|
|
||||||
git commit -m "Update .app files"
|
git commit -m "Update .app files"
|
||||||
# Create a temporary branch for the PR
|
|
||||||
git checkout -b pr-update-app-files
|
git checkout -b pr-update-app-files
|
||||||
git push origin pr-update-app-files --force
|
git push origin pr-update-app-files --force
|
||||||
|
|
||||||
# Create PR against main
|
|
||||||
gh pr create --title "[core] update .app files" \
|
gh pr create --title "[core] update .app files" \
|
||||||
--body "This PR is auto-generated by a Github Action to update the .app files." \
|
--body "This PR is auto-generated by a GitHub Action to update the .app files." \
|
||||||
--head pr-update-app-files \
|
--head pr-update-app-files \
|
||||||
--base main \
|
--base main \
|
||||||
--label "automated pr"
|
--label "automated pr"
|
||||||
@ -77,21 +73,15 @@ jobs:
|
|||||||
if: steps.verify-diff.outputs.changed == 'false'
|
if: steps.verify-diff.outputs.changed == 'false'
|
||||||
run: echo "No changes to commit. Workflow completed successfully."
|
run: echo "No changes to commit. Workflow completed successfully."
|
||||||
|
|
||||||
|
# Step 8: Re-approve pull request after update
|
||||||
- name: Re-approve pull request after update
|
- name: Re-approve pull request after update
|
||||||
if: steps.verify-diff.outputs.changed == 'true'
|
if: steps.verify-diff.outputs.changed == 'true'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Get the PR number for the current branch
|
|
||||||
PR_NUMBER=$(gh pr list --head "pr-update-app-files" --json number --jq '.[].number')
|
PR_NUMBER=$(gh pr list --head "pr-update-app-files" --json number --jq '.[].number')
|
||||||
|
|
||||||
# Check if a PR number was retrieved
|
|
||||||
if [ -n "$PR_NUMBER" ]; then
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
# Get the PR author
|
|
||||||
PR_AUTHOR=$(gh pr view "$PR_NUMBER" --json author --jq '.author.login')
|
PR_AUTHOR=$(gh pr view "$PR_NUMBER" --json author --jq '.author.login')
|
||||||
|
|
||||||
# Approve the PR if it was not created by the bot
|
|
||||||
if [ "$PR_AUTHOR" != "github-actions[bot]" ]; then
|
if [ "$PR_AUTHOR" != "github-actions[bot]" ]; then
|
||||||
gh pr review "$PR_NUMBER" --approve
|
gh pr review "$PR_NUMBER" --approve
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user