Update pull-request.yml #46
This file contains 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: CI - Pull Request | |
on: | |
pull_request_target: | |
pull_request: #TODO: Remove this | |
jobs: | |
set-env: | |
name: "Set environment" | |
runs-on: ubuntu-latest | |
outputs: | |
env: ${{ steps.get_env.outputs.env }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
ref: ${{ github.head_ref }} | |
- name: Determine Environment | |
id: get_env | |
run: | | |
codeowners=$(cat .github/CODEOWNERS) | |
if [[ $(echo "${codeowners[@]}" | fgrep -w "@${{github.actor}}") ]]; then | |
echo PROWNER | |
echo "env=pr_owner" >> $GITHUB_OUTPUT | |
else | |
echo PR | |
echo "env=pr" >> $GITHUB_OUTPUT | |
fi | |
code-quality: | |
name: Code quality | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: set-env | |
environment: ${{needs.set-env.outputs.env}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
ref: ${{ github.head_ref }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
cache: true | |
- uses: ZebraDevs/flutter-code-quality@feat/add-inputs | |
with: | |
token: ${{secrets.GITHUB_TOKEN}} | |
run-tests: false | |
run-coverage: false | |
deploy-preview: | |
name: Deploy preview version of the example app on firebase | |
needs: code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
- name: Setup flutter | |
run: flutter pub get | |
- name: Build example app | |
run: | | |
cd example | |
flutter build web -o ../build --no-tree-shake-icons | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZDS_FLUTTER }}" | |
expires: 7d | |
projectId: zds-c9c24 | |
channelId: "pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}" |