Merge pull request #1877 from Admidio/set-admidio-tab-to-default-pref… #28
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: Sort en.xml | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - languages/en.xml | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sort-en-xml: | |
| if: ${{ github.repository_owner == 'Admidio' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install lxml | |
| run: pip install lxml | |
| - name: Run sort script | |
| run: python .github/scripts/sort_en_xml.py | |
| - name: Create Pull Request | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| if git diff --quiet; then | |
| echo "No changes detected." | |
| else | |
| NEW_BRANCH=sort-language-file-$(date +'%Y%m%d') | |
| echo "NEW_BRANCH=$NEW_BRANCH" >> $GITHUB_ENV | |
| git checkout -b $NEW_BRANCH | |
| git add languages/en.xml | |
| git commit -m "chore: sort en.xml alphabetically" | |
| git push --set-upstream origin $NEW_BRANCH | |
| gh pr create \ | |
| --title "chore: sort en.xml alphabetically" \ | |
| --body "Created with GitHub Actions" \ | |
| --label "translation" \ | |
| --assignee ${{ github.actor }} \ | |
| --base master | |
| fi | |
| - name: Add Reviewer | |
| if: success() | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ -n "$NEW_BRANCH" ]; then | |
| PR_NUMBER=$(gh pr list --head $NEW_BRANCH --json number --jq '.[0].number') | |
| curl -s -X POST \ | |
| -H "Authorization: token $GITHUB_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers \ | |
| -d '{"reviewers":["Fasse"]}' | |
| else | |
| echo "No new branch created, skipping reviewer assignment." | |
| fi |