Skip to content

Commit

Permalink
feat(storm-ops): Update the workflows to send requests to Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Aug 4, 2024
1 parent 44628c8 commit 65332dd
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 39 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ on:
description: GitHub token
type: string
required: true
escapedRepository:
description: The escaped repository name
type: string
required: false
default: ${{ github.repository }}
secrets:
STORM_BOT_GITHUB_TOKEN:
description: GitHub token of the Storm bot
Expand Down Expand Up @@ -261,8 +266,8 @@ jobs:
- name: Send Telegram notification - Deployment successful
run: |
notification_text="*Deployment for [${{
github.repository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) has completed successfully \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Completed \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
inputs.escapedRepository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ inputs.escapedRepository }}) has completed successfully \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Completed \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ inputs.escapedRepository }}/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
Expand Down Expand Up @@ -415,7 +420,7 @@ jobs:
- name: Send Telegram notification - Deployment cancelled
run: |
notification_text="*Deployment for [${{
github.repository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) was cancelled before processing completed \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Cancelled \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
storm\\-software/storm\\-ops }}@${{
github.ref_name || github.sha }}](https://github.com/storm\\-software/storm\\-ops) was cancelled before processing completed \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Cancelled \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/storm\\-software/storm\\-ops/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
34 changes: 12 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ jobs:
} }]'

- name: Send Telegram notification - Deployment started
run: |
notification_text="*Deployment for [${{ github.repository }}@${{ github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) has started \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: In Progress \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
uses: storm-software/action-telegram-notify@main
with:
status: "In Progress"

- name: Setup workspace
uses: storm-software/action-setup@main
Expand Down Expand Up @@ -278,12 +277,9 @@ jobs:
}}]'

- name: Send Telegram notification - Deployment successful
run: |
notification_text="*Deployment for [${{
github.repository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) has completed successfully \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Completed \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
uses: storm-software/action-telegram-notify@main
with:
status: "Success"

failure:
needs:
Expand Down Expand Up @@ -354,12 +350,9 @@ jobs:
} }]'

- name: Send Telegram notification - Deployment failed
run: |
notification_text="*Deployment for [${{
github.repository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) experienced failures during execution \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Failed \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
uses: storm-software/action-telegram-notify@main
with:
status: "Failed"

cancelled:
needs:
Expand Down Expand Up @@ -431,9 +424,6 @@ jobs:
} }]'

- name: Send Telegram notification - Deployment cancelled
run: |
notification_text="*Deployment for [${{
github.repository }}@${{
github.ref_name || github.sha }}](https://github.com/${{ github.repository }}) was cancelled before processing completed \\- #${{ github.run_number }}* \n\nPipeline details: \n - Pipeline Status: Cancelled \n - Commit User: ${{ github.actor || 'No actor found' }} \n - Commit Message: ${{ github.event.head_commit.message || github.event.pull_request.message || 'N/A' }} \n\n*[Click here to see the full workflow details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}/sendMessage' \
-d "chat_id=-1002176435963&text=${notification_text}&parse_mode=MarkdownV2"
uses: storm-software/action-telegram-notify@main
with:
status: "Cancelled"
35 changes: 31 additions & 4 deletions packages/build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,32 @@
"open-system",
"monorepo"
],
"dependencies": {
"@anatine/esbuild-decorators": "0.2.19",
"peerDependencies": {
"@microsoft/api-extractor": "7.46.2",
"@nx/devkit": "^19.5.6",
"@nx/devkit": "19.5.6",
"@nx/js": "^19.5.6",
"@nx/workspace": "^19.5.6",
"@nx/workspace": "19.5.6",
"nx": "^19.5.6"
},
"peerDependenciesMeta": {
"@microsoft/api-extractor": {
"optional": true
},
"@nx/devkit": {
"optional": false
},
"@nx/js": {
"optional": false
},
"@nx/workspace": {
"optional": false
},
"nx": {
"optional": false
}
},
"dependencies": {
"@anatine/esbuild-decorators": "0.2.19",
"@rollup/plugin-commonjs": "25.0.8",
"@rollup/plugin-image": "3.0.3",
"@rollup/plugin-json": "6.1.0",
Expand Down Expand Up @@ -69,5 +89,12 @@
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@microsoft/api-extractor": "7.46.2",
"@nx/devkit": "^19.5.6",
"@nx/js": "^19.5.6",
"@nx/workspace": "^19.5.6",
"nx": "^19.5.6"
}
}
6 changes: 5 additions & 1 deletion packages/workspace-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@
"monorepo"
],
"peerDependencies": {
"@microsoft/api-extractor": "7.46.2",
"@nx/devkit": "^19.5.6",
"@nx/esbuild": "19.5.6",
"nx": "^19.5.6"
},
"peerDependenciesMeta": {
"@microsoft/api-extractor": {
"optional": true
},
"@nx/devkit": {
"optional": false
},
Expand All @@ -67,7 +71,6 @@
"dependencies": {
"@anatine/esbuild-decorators": "0.2.19",
"@ltd/j-toml": "1.38.0",
"@microsoft/api-extractor": "7.46.2",
"@nx/devkit": "^19.5.6",
"@rollup/plugin-json": "6.1.0",
"@size-limit/esbuild": "11.1.4",
Expand Down Expand Up @@ -97,6 +100,7 @@
"zod-to-json-schema": "3.23.1"
},
"devDependencies": {
"@microsoft/api-extractor": "7.46.2",
"@nx/esbuild": "19.5.6",
"@types/micromatch": "4.0.9",
"@types/semver": "7.5.8",
Expand Down
5 changes: 2 additions & 3 deletions packages/workspace-tools/src/executors/tsup/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { TsupExecutorSchema } from "./schema.d";
export async function tsupExecutorFn(
options: TsupExecutorSchema,
context: ExecutorContext,
config?: StormConfig
config: StormConfig
) {
const { writeInfo, writeSuccess } = await import(
"@storm-software/config-tools"
Expand All @@ -35,8 +35,7 @@ export async function tsupExecutorFn(

// #region Run the build process

// biome-ignore lint/style/noNonNullAssertion: <explanation>
await build(config!, {
await build(config, {
...options,
projectRoot:
context.projectsConfigurations.projects?.[context.projectName]?.root,
Expand Down
6 changes: 3 additions & 3 deletions packages/workspace-tools/src/executors/tsup/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@
"apiReport": {
"type": "boolean",
"description": "Should API Extractor generate an API Report file.",
"default": true
"default": false
},
"docModel": {
"type": "boolean",
"description": "Should API Extractor generate an Doc Model markdown file.",
"default": true
"default": false
},
"tsdocMetadata": {
"type": "boolean",
"description": "Should API Extractor generate an TSDoc Metadata file.",
"default": true
"default": false
},
"options": {
"type": "object",
Expand Down
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 65332dd

Please sign in to comment.