LKPR 13.5 and LKPR Live 1.1 (#115) #145
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: Update AvailProfiles.json | |
| on: | |
| push: | |
| paths: | |
| - "Airports/**" # only run if files under Airports/ change | |
| workflow_dispatch: # still allow manual runs | |
| jobs: | |
| update-profiles: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5.3.0 | |
| with: | |
| python-version: 3.x | |
| - name: Install dependencies | |
| run: pip install jq | |
| - name: Generate AvailProfiles.json | |
| run: | | |
| echo "Updating AvailProfiles.json..." | |
| python .github/scripts/update_availprofiles.py | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Commit changes | |
| run: | | |
| git add AvailProfiles.json | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "Auto-update AvailProfiles.json" | |
| - name: Get changes summary | |
| id: changes | |
| run: | | |
| # Get the diff of AvailProfiles.json to show what changed | |
| if git diff --cached --name-only | grep -q "AvailProfiles.json"; then | |
| echo "CHANGES_SUMMARY<<EOF" >> $GITHUB_OUTPUT | |
| echo "## Changes to AvailProfiles.json" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "\`\`\`diff" >> $GITHUB_OUTPUT | |
| git diff --cached AvailProfiles.json >> $GITHUB_OUTPUT | |
| echo "\`\`\`" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| echo "CHANGES_SUMMARY=No changes detected in AvailProfiles.json" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| branch: auto/update-profiles | |
| commit-message: Auto-update AvailProfiles.json | |
| title: "Auto-update AvailProfiles.json" | |
| body: | | |
| This PR was automatically generated by GitHub Actions. | |
| It updates `AvailProfiles.json` after changes were made in `Airports/`. | |
| ${{ steps.changes.outputs.CHANGES_SUMMARY }} | |
| labels: automated | |
| delete-branch: true | |
| - name: Enable auto-merge | |
| if: steps.cpr.outputs.pull-request-url != '' | |
| run: gh pr merge --auto --squash --delete-branch "${{ steps.cpr.outputs.pull-request-url }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |