Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
79 changes: 44 additions & 35 deletions .github/workflows/deploy-frontend-azurepreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@ jobs:
#########################################

branch-name:
runs-on: ubuntu-latest
outputs:
lowercase: ${{ steps.string.outputs.lowercase }}

steps:
- id: string
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.head_ref || github.ref_name }}
runs-on: ubuntu-latest
outputs:
lowercase: ${{ steps.string.outputs.lowercase }}
sanitized: ${{ steps.sanitize.outputs.sanitized }}

steps:
- id: string
uses: ASzc/change-string-case-action@v5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the current commit SHA for ASzc/change-string-case-action v5
gh api repos/ASzc/change-string-case-action/git/ref/tags/v5 --jq '.object.sha' 2>/dev/null || echo "Could not resolve tag"

Repository: airqo-platform/AirQo-frontend

Length of output: 114


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE=".github/workflows/deploy-frontend-azurepreview.yml"

echo "---- File head (first 120 lines) ----"
nl -ba "$FILE" | sed -n '1,120p'

echo "---- Lines around 29 ----"
nl -ba "$FILE" | sed -n '20,45p'

echo "---- Extract on: section (quick) ----"
awk 'BEGIN{in_on=0}
     /^(on:|on )/{in_on=1}
     in_on{print}
     /^[^ ]/ && in_on && $0 !~ /^on:/ {exit}' "$FILE" || true

Repository: airqo-platform/AirQo-frontend

Length of output: 172


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE=".github/workflows/deploy-frontend-azurepreview.yml"
echo "== sanity: file = $FILE =="
ls -la "$FILE" || true
echo "== first 140 lines =="
cat -n "$FILE" | sed -n '1,140p'
echo "== around uses line (lines 20-60) =="
cat -n "$FILE" | sed -n '20,60p'
echo "== grep for pull_request_target / pull_request =="
rg -n "pull_request_target|pull_request" "$FILE" || true

Repository: airqo-platform/AirQo-frontend

Length of output: 8930


Pin ASzc/change-string-case-action to a commit SHA for supply-chain security.

This workflow runs on pull_request_target and currently uses ASzc/change-string-case-action@v5 (line 29). Pin it to the v5 tag’s commit SHA: 07c1e24a97f0951e13f88870b99c058fcf0b14cf.

Example pin format
        - id: string
-          uses: ASzc/change-string-case-action@v5
+          uses: ASzc/change-string-case-action@07c1e24a97f0951e13f88870b99c058fcf0b14cf  # v5
          with:
            string: ${{ github.head_ref || github.ref_name }}
📝 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
uses: ASzc/change-string-case-action@v5
- id: string
uses: ASzc/change-string-case-action@07c1e24a97f0951e13f88870b99c058fcf0b14cf # v5
with:
string: ${{ github.head_ref || github.ref_name }}
🧰 Tools
🪛 zizmor (1.25.2)

[error] 29-29: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/deploy-frontend-azurepreview.yml at line 29, Replace the
unpinned action reference "uses: ASzc/change-string-case-action@v5" with the
commit-pinned reference using the v5 tag’s SHA so the workflow is pinned to a
specific commit; update the uses line to
"ASzc/change-string-case-action@07c1e24a97f0951e13f88870b99c058fcf0b14cf" (keep
the same action name but swap the tag for the given SHA).

with:
string: ${{ github.head_ref || github.ref_name }}

- name: sanitize branch name
id: sanitize
env:
RAW: ${{ steps.string.outputs.lowercase }}
run: |
CLEAN=$(printf '%s' "${RAW:0:12}" | sed 's/-*$//')
echo "sanitized=$CLEAN" >> $GITHUB_OUTPUT

#########################################
# DETECT CHANGED SERVICES
Expand Down Expand Up @@ -132,8 +141,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-website-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-website-preview"
ENV_VARS="SECRET=${{ secrets.WEBSITE_SECRET }} API_URL=${{ secrets.WEBSITE_STAGE_API_URL }} OPENCAGE_API_KEY=${{ secrets.WEBSITE_STAGE_OPENCAGE_API_KEY }} API_TOKEN=${{ secrets.WEBSITE_STAGE_API_TOKEN }} SLACK_WEBHOOK_URL=${{ secrets.WEBSITE_STAGE_SLACK_WEBHOOK_URL }} SLACK_CHANNEL=${{ secrets.WEBSITE_STAGE_SLACK_CHANNEL }} NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN }} NEXT_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_GA_MEASUREMENT_ID }} GOOGLE_SITE_VERIFICATION=${{ secrets.WEBSITE_STAGE_GOOGLE_SITE_VERIFICATION }} NEXT_PUBLIC_SITE_URL=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_SITE_URL }}"
az containerapp up \
--name $APP \
Expand All @@ -149,8 +158,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-website-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-website-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down Expand Up @@ -214,8 +223,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-beacon-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-beacon-preview"

az containerapp up \
--name $APP \
Expand All @@ -231,8 +240,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-beacon-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-beacon-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down Expand Up @@ -295,8 +304,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-calibrate-app-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-calibrate-app-preview"

az containerapp up \
--name $APP \
Expand All @@ -312,8 +321,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-calibrate-app-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-calibrate-app-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down Expand Up @@ -379,8 +388,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-analytics-p-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-analytics-p-preview"

az containerapp up \
--name $APP \
Expand All @@ -396,8 +405,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-analytics-p-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-analytics-p-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down Expand Up @@ -448,8 +457,8 @@ jobs:

- name: Pull secrets from Key Vault
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-vertex-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-vertex-preview"

DEFAULT_DOMAIN=$(az containerapp env show \
--name ${{ env.PR_PREVIEW_ENV }} \
Expand Down Expand Up @@ -477,8 +486,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-vertex-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-vertex-preview"

mapfile -t ENV_VARS < <(jq -r 'to_entries[] | select(.key != "NEXTAUTH_URL" and .key != "NEXTAUTH_URL_INTERNAL" and .key != "NEXTAUTH_COOKIE_DOMAIN") | "\(.key)=\(.value|tostring)"' secrets.json)
ENV_VARS+=("NEXTAUTH_URL=$NEXTAUTH_URL")
Expand Down Expand Up @@ -530,8 +539,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-vertex-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-vertex-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down Expand Up @@ -594,8 +603,8 @@ jobs:

- name: Deploy Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-docs-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-docs-preview"

az containerapp up \
--name $APP \
Expand All @@ -611,8 +620,8 @@ jobs:

- id: preview
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-docs-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-docs-preview"

URL=$(az containerapp show \
--name $APP \
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/remove-deploy-azurepreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@ jobs:
runs-on: ubuntu-latest
outputs:
lowercase: ${{ steps.string.outputs.lowercase }}
sanitized: ${{ steps.sanitize.outputs.sanitized }}
steps:
- id: string
uses: ASzc/change-string-case-action@v2
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.head_ref || github.ref_name }}

- name: sanitize branch name
id: sanitize
env:
RAW: ${{ steps.string.outputs.lowercase }}
run: |
CLEAN=$(printf '%s' "${RAW:0:12}" | sed 's/-*$//')
echo "sanitized=$CLEAN" >> $GITHUB_OUTPUT
Comment thread
coderabbitai[bot] marked this conversation as resolved.

check:
name: check for available deploy previews
outputs:
Expand All @@ -44,8 +53,7 @@ jobs:
- name: check modified services
id: check_files
run: |

git diff --name-only HEAD^ HEAD > files.txt
git diff --name-only "origin/${{ github.base_ref }}"...HEAD > files.txt

echo "remove_calibrate_app_preview=false" >>$GITHUB_OUTPUT
echo "remove_analytics_platform=false" >>$GITHUB_OUTPUT
Expand All @@ -56,31 +64,24 @@ jobs:

while IFS= read -r file
do

if [[ $file == src/calibrate/* ]]; then
echo "remove_calibrate_app_preview=true" >>$GITHUB_OUTPUT
fi

if [[ $file == src/platform/* ]]; then
echo "remove_analytics_platform=true" >>$GITHUB_OUTPUT
fi

if [[ $file == src/vertex/* ]]; then
echo "remove_vertex=true" >>$GITHUB_OUTPUT
fi

if [[ $file == src/beacon/* ]]; then
echo "remove_beacon=true" >>$GITHUB_OUTPUT
fi

if [[ $file == src/docs-website/* ]]; then
echo "remove_docs=true" >>$GITHUB_OUTPUT
fi

if [[ $file == src/website/* ]]; then
echo "remove_website=true" >>$GITHUB_OUTPUT
fi

done < files.txt

########################################################
Expand All @@ -101,8 +102,8 @@ jobs:

- name: Delete Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-calibrate-app-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-calibrate-app-preview"

az containerapp delete \
--name $APP \
Expand All @@ -126,10 +127,9 @@ jobs:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Delete Container App

run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-analytics-p-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-analytics-p-preview"

az containerapp delete \
--name $APP \
Expand All @@ -154,8 +154,8 @@ jobs:

- name: Delete Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-website-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-website-preview"

az containerapp delete \
--name $APP \
Expand All @@ -180,8 +180,8 @@ jobs:

- name: Delete Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-vertex-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-vertex-preview"

az containerapp delete \
--name $APP \
Expand All @@ -206,8 +206,8 @@ jobs:

- name: Delete Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-beacon-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-beacon-preview"

az containerapp delete \
--name $APP \
Expand All @@ -232,8 +232,8 @@ jobs:

- name: Delete Container App
run: |
BRANCH="${{ needs.branch-name.outputs.lowercase }}"
APP="${BRANCH:0:12}-docs-preview"
BRANCH="${{ needs.branch-name.outputs.sanitized }}"
APP="${BRANCH}-docs-preview"

az containerapp delete \
--name $APP \
Expand Down
2 changes: 1 addition & 1 deletion src/beacon/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AirQo Device Health Monitoring Frontend.
# AirQo Device Health Monitoring Frontend

## Node.js Version Requirement
This project requires **Node.js v22.x**. Please ensure you are using Node.js 22 for development and production environments.
Expand Down
2 changes: 1 addition & 1 deletion src/docs-website/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AirQo Digital Products Documentation .
# AirQo Digital Products Documentation

This repository hosts the centralized documentation hub for all AirQo digital products, including Analytics, Vertex, Beacon, AI Platform, and the API. It is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

Expand Down
2 changes: 1 addition & 1 deletion src/platform/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started
## Getting Started.

First, run the development server:

Expand Down
2 changes: 1 addition & 1 deletion src/vertex/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Vertex (Web App)
# Vertex (Web App).

`vertex` is the AirQo web application for Device and Network management.

Expand Down
2 changes: 1 addition & 1 deletion src/website/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Website.
# Website

Welcome to the Website repository, part of the AirQo Frontend project. This website is built with [Next.js](https://nextjs.org) and was bootstrapped using [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). The live website can be found at [airqo.net](https://airqo.net)

Expand Down
Loading