Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
37 changes: 37 additions & 0 deletions .github/workflows/react-native-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,41 @@ jobs:
run: |
firebase appdistribution:distribute ./ResgridUnit-ios-adhoc.ipa --app ${{ secrets.FIREBASE_IOS_APP_ID }} --groups "testers"

- name: 📋 Extract Release Notes from PR Body
if: ${{ github.event_name == 'pull_request' && matrix.platform == 'android' }}
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
set -eo pipefail
# Grab lines after "## Release Notes" until the next header
RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
| awk 'f && /^## /{f=0} /^## Release Notes/{f=1; next} f')"
# Use a unique delimiter to write multiline into GITHUB_ENV
delimiter="EOF_$(date +%s)_$RANDOM"
{
echo "RELEASE_NOTES<<$delimiter"
printf '%s\n' "${RELEASE_NOTES:-No release notes provided.}"
echo "$delimiter"
} >> "$GITHUB_ENV"

Comment on lines +279 to +295

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Release notes extraction step will never run due to job-level event gating

The build-and-deploy job only runs on push/workflow_dispatch, but this step is gated to pull_request events. As a result, RELEASE_NOTES is never populated from the PR body, and downstream steps will always use the fallback.

Fix by removing the event gate and restricting to the android matrix leg. Also make the header match case-insensitive and more whitespace-tolerant.

-      - name: 📋 Extract Release Notes from PR Body
-        if: ${{ github.event_name == 'pull_request' && matrix.platform == 'android' }}
+      - name: 📋 Extract Release Notes from PR Body
+        if: ${{ matrix.platform == 'android' }}
         env:
           PR_BODY: ${{ github.event.pull_request.body }}
         run: |
-          set -eo pipefail
-          # Grab lines after "## Release Notes" until the next header
-          RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
-            | awk 'f && /^## /{f=0} /^## Release Notes/{f=1; next} f')"
+          set -eo pipefail
+          # Grab lines after "## Release Notes" (case-insensitive) until the next "## " header
+          RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
+            | awk 'BEGIN{IGNORECASE=1} f && /^##[[:space:]]/{f=0} /^##[[:space:]]*Release Notes[[:space:]]*$/ {f=1; next} f')"
           # Use a unique delimiter to write multiline into GITHUB_ENV
           delimiter="EOF_$(date +%s)_$RANDOM"
           {
             echo "RELEASE_NOTES<<$delimiter"
             printf '%s\n' "${RELEASE_NOTES:-No release notes provided.}"
             echo "$delimiter"
           } >> "$GITHUB_ENV"

If you truly need PR-body-driven notes on push (post-merge), consider fetching the merged PR’s body via the GitHub API (gh or curl) in push/workflow_dispatch runs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: 📋 Extract Release Notes from PR Body
if: ${{ github.event_name == 'pull_request' && matrix.platform == 'android' }}
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
set -eo pipefail
# Grab lines after "## Release Notes" until the next header
RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
| awk 'f && /^## /{f=0} /^## Release Notes/{f=1; next} f')"
# Use a unique delimiter to write multiline into GITHUB_ENV
delimiter="EOF_$(date +%s)_$RANDOM"
{
echo "RELEASE_NOTES<<$delimiter"
printf '%s\n' "${RELEASE_NOTES:-No release notes provided.}"
echo "$delimiter"
} >> "$GITHUB_ENV"
- name: 📋 Extract Release Notes from PR Body
if: ${{ matrix.platform == 'android' }}
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
- set -eo pipefail
- # Grab lines after "## Release Notes" until the next header
- RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
set -eo pipefail
# Grab lines after "## Release Notes" (case-insensitive) until the next "## " header
RELEASE_NOTES="$(printf '%s\n' "$PR_BODY" \
| awk 'BEGIN{IGNORECASE=1} f && /^##[[:space:]]/{f=0} /^##[[:space:]]*Release Notes[[:space:]]*$/ {f=1; next} f')"
# Use a unique delimiter to write multiline into GITHUB_ENV
delimiter="EOF_$(date +%s)_$RANDOM"
{
echo "RELEASE_NOTES<<$delimiter"
printf '%s\n' "${RELEASE_NOTES:-No release notes provided.}"
echo "$delimiter"
} >> "$GITHUB_ENV"

- name: 📋 Prepare Release Notes file
if: ${{ matrix.platform == 'android' }}
run: |
{
echo "## Version 7.${{ github.run_number }} - $(date +%Y-%m-%d)"
echo
printf '%s\n' "${RELEASE_NOTES:-No release notes provided.}"
} > RELEASE_NOTES.md

- name: 📦 Create Release
if: ${{ matrix.platform == 'android' }}
uses: ncipollo/release-action@v1
with:
tag: "7.${{ github.run_number }}"
commit: ${{ github.sha }}
makeLatest: true
allowUpdates: true
name: "7.${{ github.run_number }}"
artifacts: "./ResgridUnit-prod.apk"
bodyFile: "RELEASE_NOTES.md"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

1 change: 1 addition & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
},
assetBundlePatterns: ['**/*'],
ios: {
icon: './assets/ios-icon.png',
version: packageJSON.version,
buildNumber: packageJSON.version,
supportsTablet: true,
Expand Down
Binary file added assets/ios-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/splash-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const client = z.object({
BASE_API_URL: z.string(),
API_VERSION: z.string(),
RESGRID_API_URL: z.string(),
CHANNEL_API_URL: z.string(),
CHANNEL_HUB_NAME: z.string(),
REALTIME_GEO_HUB_NAME: z.string(),
LOGGING_KEY: z.string(),
Expand Down Expand Up @@ -118,7 +117,6 @@ const _clientEnv = {
BASE_API_URL: process.env.UNIT_BASE_API_URL || 'https://qaapi.resgrid.dev',
API_VERSION: process.env.UNIT_API_VERSION || 'v4',
RESGRID_API_URL: process.env.UNIT_RESGRID_API_URL || '/api/v4',
CHANNEL_API_URL: process.env.UNIT_CHANNEL_API_URL || 'https://qaevents.resgrid.dev/',
CHANNEL_HUB_NAME: process.env.UNIT_CHANNEL_HUB_NAME || 'eventingHub',
REALTIME_GEO_HUB_NAME: process.env.UNIT_REALTIME_GEO_HUB_NAME || 'geolocationHub',
LOGGING_KEY: process.env.UNIT_LOGGING_KEY || '',
Expand Down
19 changes: 19 additions & 0 deletions jest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,22 @@ jest.mock('nativewind', () => ({
})),
__esModule: true,
}));

// Mock zod globally to avoid validation schema issues in tests
jest.mock('zod', () => ({
z: {
object: jest.fn(() => ({
parse: jest.fn((data) => data),
safeParse: jest.fn((data) => ({ success: true, data })),
})),
string: jest.fn(() => ({
min: jest.fn(() => ({
parse: jest.fn((data) => data),
safeParse: jest.fn((data) => ({ success: true, data })),
})),
parse: jest.fn((data) => data),
safeParse: jest.fn((data) => ({ success: true, data })),
})),
},
__esModule: true,
}));
16 changes: 16 additions & 0 deletions src/app/call/new/__tests__/address-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,21 @@ describe('Address Search Logic', () => {
const mockConfig: GetConfigResultData = {
GoogleMapsKey: 'test-api-key',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

beforeEach(() => {
Expand Down Expand Up @@ -143,13 +151,21 @@ describe('Address Search Logic', () => {
const configWithoutKey: GetConfigResultData = {
GoogleMapsKey: '',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

const result = await performAddressSearch('123 Main St', configWithoutKey);
Expand Down
16 changes: 16 additions & 0 deletions src/app/call/new/__tests__/coordinates-search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,21 @@ describe('Coordinates Search Logic', () => {
const mockConfig: GetConfigResultData = {
GoogleMapsKey: 'test-api-key',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

beforeEach(() => {
Expand Down Expand Up @@ -249,13 +257,21 @@ describe('Coordinates Search Logic', () => {
const configWithoutKey: GetConfigResultData = {
GoogleMapsKey: '',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

const result = await performCoordinatesSearch('40.7128, -74.0060', configWithoutKey);
Expand Down
16 changes: 16 additions & 0 deletions src/app/call/new/__tests__/plus-code-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ describe('Plus Code Search Logic', () => {
const mockConfig: GetConfigResultData = {
GoogleMapsKey: 'test-api-key',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

beforeEach(() => {
Expand Down Expand Up @@ -116,13 +124,21 @@ describe('Plus Code Search Logic', () => {
const configWithoutKey: GetConfigResultData = {
GoogleMapsKey: '',
W3WKey: '',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

const result = await performPlusCodeSearch('849VCWC8+R9', configWithoutKey);
Expand Down
8 changes: 8 additions & 0 deletions src/app/call/new/__tests__/what3words.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ const mockedAxios = axios as jest.Mocked<typeof axios>;
const mockConfig: GetConfigResultData = {
GoogleMapsKey: 'test-mapbox-key',
W3WKey: 'test-api-key',
EventingUrl: '',
LoggingKey: '',
MapUrl: '',
MapAttribution: '',
OpenWeatherApiKey: '',
DirectionsMapKey: '',
PersonnelLocationStaleSeconds: 300,
UnitLocationStaleSeconds: 300,
PersonnelLocationMinMeters: 15,
UnitLocationMinMeters: 15,
NovuBackendApiUrl: '',
NovuSocketUrl: '',
NovuApplicationId: '',
AnalyticsApiKey: '',
AnalyticsHost: '',
};

// Mock the core store
Expand Down
Loading