Skip to content

feat(APP-1134): answer product questions in the support assistant from the knowledge base #650

feat(APP-1134): answer product questions in the support assistant from the knowledge base

feat(APP-1134): answer product questions in the support assistant from the knowledge base #650

name: App Release PR Deploy
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
notify-start:
if: startsWith(github.head_ref, 'release/app/')
runs-on: ubuntu-latest
outputs:
slack-ts: ${{ steps.notify.outputs.ts }}
steps:
- name: Load secrets
id: secrets
uses: 1password/load-secrets-action@eb2efd0703da22a93c467f2d1ffbb6826c11e19c # v4.0.0 (https://github.com/1Password/load-secrets-action/releases/tag/v4.0.0)
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: '${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}'
SLACK_BOT_TOKEN: op://kv_app_infra/SLACK_BOT_TOKEN/credential
SLACK_CHANNEL_ID: op://kv_app_infra/SLACK_CHANNEL_ID/credential
ARABOT_PAT: op://kv_app_infra/ARABOT_PAT/credential
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
sparse-checkout: |
.github/actions/extract-slack-ts
.github/actions/gh-pr-get-body
.github/actions/gh-pr-edit-body
.github/actions/slack-notify
.github/workflows/scripts/slackNotify.js
- name: Read PR body for existing Slack TS
id: pr
uses: ./.github/actions/gh-pr-get-body
with:
pr_number: ${{ github.event.pull_request.number }}
token: ${{ github.token }}
- name: Extract existing Slack TS from PR body
id: existing-ts
uses: ./.github/actions/extract-slack-ts
with:
body: ${{ steps.pr.outputs.body }}
- name: Notify Slack - Staging Build Started (new thread)
id: notify-new
if: ${{ !steps.existing-ts.outputs.ts && steps.secrets.outputs.SLACK_BOT_TOKEN }}
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
message: |
⏳ *Staging build & deploy started...*
*PR:* <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>
*Branch:* `${{ github.head_ref }}`
- name: Save Slack TS to PR body
if: steps.notify-new.outputs.ts && steps.secrets.outputs.ARABOT_PAT
uses: ./.github/actions/gh-pr-edit-body
with:
pr_number: ${{ github.event.pull_request.number }}
token: ${{ steps.secrets.outputs.ARABOT_PAT }}
body: |
${{ steps.pr.outputs.body }}
<!-- slack_ts: ${{ steps.notify-new.outputs.ts }} -->
- name: Notify Slack - Staging Build Started (existing thread)
id: notify-existing
if: steps.existing-ts.outputs.ts && steps.secrets.outputs.SLACK_BOT_TOKEN
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
thread_ts: ${{ steps.existing-ts.outputs.ts }}
message: |
⏳ *Staging build & deploy started...*
- name: Set final TS output
id: notify
shell: bash
run: |
TS="${{ steps.notify-new.outputs.ts || steps.existing-ts.outputs.ts }}"
echo "ts=$TS" >> "$GITHUB_OUTPUT"
test:
if: startsWith(github.head_ref, 'release/app/')
needs: notify-start
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
sparse-checkout: .github/actions/setup
- name: Setup
uses: ./.github/actions/setup
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check types
run: pnpm type-check
- name: Check linter with formatter
run: pnpm lint:check
- name: Run tests with coverage
run: pnpm test:coverage
deploy:
if: startsWith(github.head_ref, 'release/app/')
needs: test
uses: ./.github/workflows/shared-deploy.yml
secrets: inherit
with:
domain: 'stg.app.aragon.org'
env: 'staging'
ref: ${{ github.event.pull_request.head.sha }}
notify:
needs: [notify-start, deploy]
runs-on: ubuntu-latest
outputs:
slack-ts: ${{ needs.notify-start.outputs.slack-ts }}
steps:
- name: Load secrets
id: secrets
uses: 1password/load-secrets-action@eb2efd0703da22a93c467f2d1ffbb6826c11e19c # v4.0.0 (https://github.com/1Password/load-secrets-action/releases/tag/v4.0.0)
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: '${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}'
SLACK_BOT_TOKEN: op://kv_app_infra/SLACK_BOT_TOKEN/credential
SLACK_CHANNEL_ID: op://kv_app_infra/SLACK_CHANNEL_ID/credential
ARABOT_PAT: op://kv_app_infra/ARABOT_PAT/credential
LINEAR_API_TOKEN: op://kv_app_infra/LINEAR_API_TOKEN/credential
SLACK_CODEOWNERS_GROUP_ID: op://kv_app_infra/SLACK_CODEOWNERS_GROUP_ID/credential
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
sparse-checkout: .github/actions/setup
- name: Setup
uses: ./.github/actions/setup
with:
token: ${{ github.token }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Generate Release Summary
id: summary
uses: ./.github/actions/generate-release-summary
with:
package_name: "@aragon/app"
path_filter: "app"
linear_api_token: ${{ steps.secrets.outputs.LINEAR_API_TOKEN }}
- name: Update PR Description
uses: ./.github/actions/gh-pr-edit-body
with:
pr_number: ${{ github.event.pull_request.number }}
token: ${{ steps.secrets.outputs.ARABOT_PAT }}
body: |
${{ steps.summary.outputs.summary }}
<!-- slack_ts: ${{ needs.notify-start.outputs.slack-ts }} -->
# Keep the Slack head message in sync with the PR description it just regenerated
# (chat.update); thread replies below it carry the per-deploy lifecycle updates.
- name: Update Slack head message
if: needs.notify-start.outputs.slack-ts && steps.secrets.outputs.SLACK_BOT_TOKEN
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
update_ts: ${{ needs.notify-start.outputs.slack-ts }}
message: |
🚀 *${{ github.event.pull_request.title }} — Started* ${{ steps.secrets.outputs.SLACK_CODEOWNERS_GROUP_ID && format('<!subteam^{0}>', steps.secrets.outputs.SLACK_CODEOWNERS_GROUP_ID) || '' }}
*PR:* ${{ github.event.pull_request.html_url }}
${{ steps.summary.outputs.summary }}
- name: Notify Slack
if: needs.notify-start.outputs.slack-ts && steps.secrets.outputs.SLACK_BOT_TOKEN
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
thread_ts: ${{ needs.notify-start.outputs.slack-ts }}
message: |
✅ *Staging Deployed*
*Staging:* <https://stg.app.aragon.org|stg.app.aragon.org>
*Commit:* <https://github.com/aragon/app/commit/${{ github.event.pull_request.head.sha }}|${{ github.event.pull_request.head.sha }}>
Ready for testing! 🧪
• Found bugs? Create a PR with fixes to <https://github.com/aragon/app/tree/${{ github.event.pull_request.head.ref }}|${{ github.event.pull_request.head.ref }}>
• All good? Approve the PR and merge → production deploy will start automatically
e2e:
if: startsWith(github.head_ref, 'release/app/')
needs: deploy
uses: ./.github/workflows/shared-e2e.yml
secrets: inherit
with:
deployment-url: https://stg.app.aragon.org
environment: staging
bv:
if: startsWith(github.head_ref, 'release/app/')
needs: deploy
uses: ./.github/workflows/shared-bv.yml
secrets: inherit
with:
deployment-url: https://stg.app.aragon.org
environment: staging
e2e-notify:
needs: [notify, e2e, bv]
if: ${{ always() && (needs.e2e.result != 'skipped' || needs.bv.result != 'skipped') }}
runs-on: ubuntu-latest
steps:
- name: Load secrets
id: secrets
uses: 1password/load-secrets-action@eb2efd0703da22a93c467f2d1ffbb6826c11e19c # v4.0.0 (https://github.com/1Password/load-secrets-action/releases/tag/v4.0.0)
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: '${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}'
SLACK_BOT_TOKEN: op://kv_app_infra/SLACK_BOT_TOKEN/credential
SLACK_CHANNEL_ID: op://kv_app_infra/SLACK_CHANNEL_ID/credential
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
sparse-checkout: |
.github/workflows/scripts/slackNotify.js
.github/actions/slack-notify
- name: Notify Slack — test results
if: steps.secrets.outputs.SLACK_BOT_TOKEN && needs.notify.outputs.slack-ts
env:
ARTIFACT_VIEWER_HOST: gh-artifact-viewer.aragonservices.in
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
thread_ts: ${{ needs.notify.outputs.slack-ts }}
message: |
${{ needs.e2e.outputs.result == 'passed' && '✅ Smoke tests on *staging* passed' || needs.e2e.outputs.result == 'flaky' && '⚠️ Smoke tests on *staging* completed with flaky tests' || needs.e2e.outputs.result == 'failed' && '❌ Smoke tests on *staging* failed' || needs.e2e.result == 'skipped' && '' || '⏹️ Smoke tests on *staging* were cancelled' }}
${{ needs.e2e.outputs.summary }}
${{ needs.bv.outputs.result == 'passed' && '✅ BV tests on *staging* passed' || needs.bv.outputs.result == 'flaky' && '⚠️ BV tests on *staging* completed with flaky tests' || needs.bv.outputs.result == 'failed' && '❌ BV tests on *staging* failed' || needs.bv.result == 'skipped' && '' || '⏹️ BV tests on *staging* were cancelled' }}
${{ needs.bv.outputs.summary }}
<https://${{ env.ARTIFACT_VIEWER_HOST }}/${{ github.repository }}/${{ needs.e2e.outputs.report_artifact_id }}/index.html|View smoke report> | <https://${{ env.ARTIFACT_VIEWER_HOST }}/${{ github.repository }}/${{ needs.bv.outputs.report_artifact_id }}/index.html|View BV report>