Files
game-tracker/.gitea/workflows/pull_request.yaml
Felix Kirchner 07c9e6663d
All checks were successful
Pull Request Pipeline / lint (pull_request) Has been skipped
Pull Request Pipeline / test (pull_request) Has been skipped
Pull Request Pipeline / localizations (pull_request) Has been skipped
Pull Request Pipeline / sort_arb_files (pull_request) Successful in 30s
Fixed pipeline
2026-05-22 16:00:18 +02:00

163 lines
4.3 KiB
YAML

name: Pull Request Pipeline
on:
pull_request:
jobs:
lint:
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Required for Flutter action
- name: Install jq
run: |
apt-get update
apt-get install -y jq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.41.0
- name: Get dependencies
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
flutter pub get
- name: Analyze Formatting
run: flutter analyze lib test
test:
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Required for Flutter action
- name: Install jq
run: |
apt-get update
apt-get install -y jq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.41.0
- name: Get dependencies
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
flutter pub get
- name: Run tests
run: flutter test
localizations:
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Required for Flutter action
- name: Install jq
run: |
apt-get update
apt-get install -y jq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.41.0
- name: Get dependencies
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
flutter pub get
- name: Check for untranslated messages
run: |
flutter gen-l10n --no-use-deferred-loading
UNTRANSLATED_FILE=lib/l10n/untranslated_messages.json
if [ ! -f "$UNTRANSLATED_FILE" ]; then
echo "Expected $UNTRANSLATED_FILE to be generated, but it does not exist."
exit 1
fi
CONTENT=$(tr -d '[:space:]' < "$UNTRANSLATED_FILE")
if [ "$CONTENT" != "{}" ]; then
echo "Found untranslated messages:"
cat "$UNTRANSLATED_FILE"
exit 1
fi
echo "All messages translated."
sort_arb_files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Required for Flutter action
- name: Install jq
run: |
apt-get update
apt-get install -y jq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.41.0
- name: Get dependencies
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
flutter pub get
- name: Sort .arb-Files
run: |
shopt -s nullglob
for file in lib/l10n/arb/app_*.arb; do
echo "Sorting $file"
dart run arb_utils sort "$file"
done
- name: Check for changes
id: check_changes
run: |
if [ -n "$(git status --porcelain lib/l10n/arb)" ]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit sorted .arb-Files
if: steps.check_changes.outputs.has_changes == 'true'
env:
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
BRANCH_NAME: ${{ gitea.head_ref }}
run: |
git fetch origin "$BRANCH_NAME"
git checkout "$BRANCH_NAME"
if [ -n "$(git status --porcelain lib/l10n/arb)" ]; then
git config --global user.name "Gitea Actions [bot]"
git config --global user.email "actions@yannick-weigert.de"
git config pull.rebase false
git pull origin "$BRANCH_NAME"
git add lib/l10n/arb
git commit -m "Sort .arb files [skip ci]"
git push origin "HEAD:$BRANCH_NAME"
else
echo "No changes to commit"
fi