2025-01-24 13:03:59 +00:00
|
|
|
name: Auto Update .app-files
|
2025-01-14 13:43:07 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- 'ct/**.sh'
|
2025-01-14 14:01:05 +00:00
|
|
|
workflow_dispatch: # Ermöglicht das manuelle Ausführen der Action
|
2025-01-14 13:43:07 +00:00
|
|
|
|
|
|
|
jobs:
|
2025-01-24 13:03:59 +00:00
|
|
|
update-app-files:
|
2025-01-14 13:43:07 +00:00
|
|
|
runs-on: ubuntu-latest
|
2025-01-14 13:48:47 +00:00
|
|
|
|
2025-01-14 14:01:05 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
|
2025-01-14 13:43:07 +00:00
|
|
|
steps:
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 1: Checkout repository
|
2025-01-14 13:43:07 +00:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2025-01-24 13:18:39 +00: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
|
2025-01-14 13:43:07 +00:00
|
|
|
- name: Set up Git
|
|
|
|
run: |
|
|
|
|
git config --global user.name "GitHub Actions"
|
2025-01-24 13:11:39 +00:00
|
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
2025-01-14 13:43:07 +00:00
|
|
|
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 4: Install figlet
|
2025-01-14 13:51:19 +00:00
|
|
|
- name: Install figlet
|
|
|
|
run: sudo apt-get install -y figlet
|
2025-01-14 13:48:47 +00:00
|
|
|
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 5: Run the updated generate-app-files.sh script
|
2025-01-24 13:03:59 +00:00
|
|
|
- name: Run generate-app-files.sh
|
2025-01-14 13:43:07 +00:00
|
|
|
run: |
|
2025-01-15 10:25:31 +00:00
|
|
|
chmod +x .github/workflows/scripts/generate-app-headers.sh
|
|
|
|
.github/workflows/scripts/generate-app-headers.sh
|
2025-01-14 13:48:47 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2025-01-14 13:43:07 +00:00
|
|
|
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 6: Check if there are any changes
|
2025-01-14 14:01:05 +00:00
|
|
|
- name: Check if there are any changes
|
|
|
|
id: verify-diff
|
|
|
|
run: |
|
2025-01-24 13:09:09 +00:00
|
|
|
if git diff --quiet; then
|
|
|
|
echo "No changes detected."
|
|
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "Changes detected."
|
|
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
2025-01-14 14:01:05 +00:00
|
|
|
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 7: Commit changes (if any) and create a PR
|
2025-01-14 14:01:05 +00:00
|
|
|
- name: Commit and create PR if changes exist
|
|
|
|
if: steps.verify-diff.outputs.changed == 'true'
|
2025-01-14 13:43:07 +00:00
|
|
|
run: |
|
2025-01-24 13:11:39 +00:00
|
|
|
git add -A
|
2025-01-24 13:03:59 +00:00
|
|
|
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 13:11:39 +00:00
|
|
|
--body "This PR is auto-generated by a GitHub Action to update the .app files." \
|
2025-01-24 13:03:59 +00:00
|
|
|
--head pr-update-app-files \
|
2025-01-14 14:03:00 +00:00
|
|
|
--base main \
|
|
|
|
--label "automated pr"
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2025-01-14 14:01:05 +00:00
|
|
|
|
2025-01-24 13:18:39 +00:00
|
|
|
# Step 8: Output success message when no changes
|
2025-01-24 13:09:09 +00:00
|
|
|
- name: No changes detected
|
|
|
|
if: steps.verify-diff.outputs.changed == 'false'
|
|
|
|
run: echo "No changes to commit. Workflow completed successfully."
|