Skip to content

Commit 6e3d1eb

Browse files
authored
Fix new actions (#513)
* Fix pr.yml syntax error * Update insufficient labeler.yml permissions * Update insufficient labeler.yml permissions * Update pr.yml * Don't attempt to commit when no files change * fix auto commit * only detect png changes
1 parent 469c93a commit 6e3d1eb

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

.github/workflows/labeler.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Label PRs & Issues
2-
description: Allows external contributors to add labels to add labels to issues and PRs.
32
# Note for maintainers: Don't add labels that can be abused
43

54
on:
@@ -12,6 +11,7 @@ jobs:
1211
runs-on: ubuntu-latest
1312
permissions:
1413
issues: write
14+
pull-requests: write
1515
steps:
1616
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
1717
env:
@@ -24,6 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
permissions:
2626
issues: write
27+
pull-requests: write
2728
steps:
2829
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
2930
env:

.github/workflows/pr.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121
steps:
2222
- name: Checkout code
2323
uses: actions/checkout@v4
24-
with:
25-
# ensures there are no unexpected directories needed
26-
sparse-checkout: |
27-
app
28-
health_data_store
2924
- name: Cache generated health data store
3025
id: cache-generated
3126
uses: actions/cache@v4
@@ -52,26 +47,33 @@ jobs:
5247
- name: Update app dependencies
5348
run: flutter pub get
5449
working-directory: app
55-
# Golden tests don't need mocks if they ever do this would be a good oportunity to
56-
# introduce test mock testign
50+
# TODO: cache using non-generated dart files in the test dir as key
51+
- name: Generate app mock code
52+
run: flutter pub run build_runner build
53+
working-directory: app
5754
- name: Update goldens
5855
id: gold-upd
5956
run: flutter test --update-goldens --fail-fast --name="\[gold\].*" --dart-define="channel=${{ matrix.channel }}"
6057
working-directory: app
61-
- name: PR golden changes
58+
- name: Push golden changes
6259
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-of-failure-with-conditions
6360
if: ${{ steps.gold-upd.conclusion == 'success' }}
6461
run: |
65-
git config user.name "GitHub Action (update goldens)"
66-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
67-
git add app/test/**/*.png
68-
git commit -m "Update goldens"
69-
git push
62+
if [[ $(git status -s | grep png) ]]; then
63+
git config user.name "GitHub Action (update goldens)"
64+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
65+
git add app/test/
66+
git commit -m "Update goldens"
67+
git push
68+
else
69+
echo "no changes to commit"
70+
fi
7071
env:
7172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}%
7273
test:
7374
if: contains(github.event.pull_request.labels.*.name, 'auto-test')
7475
runs-on: ubuntu-latest
76+
needs: update-goldens # this is guaranteed to fail if goldens need to be updated
7577
steps:
7678
- name: Checkout code
7779
uses: actions/checkout@v4
@@ -106,7 +108,8 @@ jobs:
106108
- name: Update app dependencies
107109
run: flutter pub get
108110
working-directory: app
109-
- name: Generate app mock code # no efficient caching possible
111+
# TODO: cache using non-generated dart files in the test dir as key
112+
- name: Generate app mock code
110113
run: flutter pub run build_runner build
111114
working-directory: app
112115
- name: Run tests
@@ -149,15 +152,15 @@ jobs:
149152
channel: ${{ matrix.channel }}
150153
cache: true
151154
- name: Disable analytics
152-
run:
153-
flutter config --no-analytics --suppress-analytics
155+
run: flutter config --no-analytics --suppress-analytics
154156
- name: Update app dependencies
155157
run: flutter pub get
156158
working-directory: app
159+
- name: Build
160+
run: flutter build apk --debug --flavor=github
157161
- name: Upload artifacts
158162
uses: actions/upload-artifact@v4
159163
with:
160164
name: build-results
161165
path: app/build/app/outputs/flutter-apk
162-
- name: Build
163-
run: flutter build apk --debug --flavor=github
166+

0 commit comments

Comments
 (0)