-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (72 loc) · 2.22 KB
/
pull-request.yml
File metadata and controls
84 lines (72 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
on:
pull_request_target:
name: CI - Pull Request
permissions:
contents: read
pull-requests: write
actions: write
jobs:
set-env:
name: "Set environment"
runs-on: ubuntu-latest
outputs:
env: ${{ steps.get_env.outputs.env }}
steps:
- name: Checkout code
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
pull_request_checks:
needs: set-env
environment: ${{needs.set-env.outputs.env}}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{github.event.pull_request.head.repo.full_name}}
ref: ${{ github.head_ref }}
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
cache: true
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: yarn install --immutable
- name: Build bundled file
run: yes | npx @vercel/ncc build src/main.ts
- name: setup flutter test repos
run: |
cd tests/fail_repo
flutter pub get
cd ../pass_repo
flutter pub get
cd ../..
- name: run tests
run: yarn run test
- name: Check for modified files
id: git-check
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV
- name: Update changes in GitHub repository
if: env.modified == 'true'
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add -A
git commit -m 'ci(automated commit): Build bundled file'
git push