Auto Update .app-files #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Update .app-files | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'ct/**.sh' | |
| workflow_dispatch: # Ermöglicht das manuelle Ausführen der Action | |
| jobs: | |
| update-app-files: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| # Step 1: Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| # Step 2: Set up Git user for committing changes | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| # Step 3: Install figlet | |
| - name: Install figlet | |
| run: sudo apt-get install -y figlet | |
| # Step 4: Run the updated generate-app-files.sh script | |
| - name: Run generate-app-files.sh | |
| run: | | |
| chmod +x .github/workflows/scripts/generate-app-headers.sh | |
| .github/workflows/scripts/generate-app-headers.sh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 5: Check if there are any changes | |
| - name: Check if there are any changes | |
| id: verify-diff | |
| run: | | |
| if git diff --quiet; then | |
| echo "No changes detected." | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected." | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| # 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 add -A | |
| 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" \ | |
| --body "This PR is auto-generated by a GitHub Action to update the .app files." \ | |
| --head pr-update-app-files \ | |
| --base main \ | |
| --label "automated pr" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 7: Output success message when no changes | |
| - name: No changes detected | |
| if: steps.verify-diff.outputs.changed == 'false' | |
| run: echo "No changes to commit. Workflow completed successfully." |