Skip to content

IS-11008: simplify folder structure and gitignore #604

IS-11008: simplify folder structure and gitignore

IS-11008: simplify folder structure and gitignore #604

name: HAAPI React App CI Workflow
on:
push:
paths:
- 'src/haapi-react-app/**'
- 'src/haapi-react-sdk/**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/haapi-react-app/**'
- 'src/haapi-react-sdk/**'
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: SDK — Check Formatting
run: npm run prettier-check -w @curity/haapi-react-sdk
- name: SDK — Lint
run: npm run lint -w @curity/haapi-react-sdk
- name: SDK — Typecheck
run: npm run typecheck -w @curity/haapi-react-sdk
- name: SDK — Run Tests
run: npm run test -w @curity/haapi-react-sdk -- run
- name: App — Check Formatting
run: npm run prettier-check -w src/haapi-react-app
- name: App — Lint
run: npm run lint -w src/haapi-react-app
- name: App — Build Project
run: npm run build:haapi-react-app
- name: App — Run Tests
run: npm run test -w src/haapi-react-app -- run
notify-slack:
name: Notify Slack
needs: build-and-test
runs-on: ubuntu-latest
if: ${{ always() && github.event_name == 'pull_request' && github.event.pull_request.draft != true }}
strategy:
matrix:
webhook_secret: [LWA_SLACK_WEBHOOK_URL]
steps:
- name: Extract Jira ticket from branch name
id: jira
run: |
TICKET=$(echo "${{ github.head_ref }}" | grep -oE '[A-Z]+-[0-9]+' | head -1)
if [ -n "$TICKET" ]; then
echo "link=*Jira:* <https://curity.atlassian.net/browse/$TICKET|$TICKET>" >> $GITHUB_OUTPUT
else
echo "link=" >> $GITHUB_OUTPUT
fi
- name: Notify new pull request
if: ${{ (github.event.action == 'opened' && github.event.pull_request.draft == false) || github.event.action == 'ready_for_review' }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"text": ":rocket: PR ready for review in `${{ github.repository }}`",
"attachments": [
{
"color": "${{ needs.build-and-test.result == 'success' && '#2EB67D' || '#E01E5A' }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Title:* ${{ github.event.pull_request.title }}\n*Author:* ${{ github.actor }}\n*Status:* ${{ needs.build-and-test.result == 'success' && ':white_check_mark: Passed' || ':x: Failed' }}\n*PR:* <${{ github.event.pull_request.html_url }}|View Pull Request> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Workflow Logs>${{ steps.jira.outputs.link && format('\n{0}', steps.jira.outputs.link) || '' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('*Description:*{0}{1}', fromJSON('"\n"'), github.event.pull_request.body || 'No description provided.')) }}
}
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets[matrix.webhook_secret] }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK