@qoretechnologies/reqraft 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/__tests__/ mock.ts +44 -0
  2. package/__tests__/utils.ts +11 -0
  3. package/dist/components/menu/Menu.d.ts +31 -0
  4. package/dist/components/menu/Menu.d.ts.map +1 -0
  5. package/dist/components/menu/Menu.js +130 -0
  6. package/dist/components/menu/Menu.js.map +1 -0
  7. package/dist/contexts/FetchContext.d.ts +10 -0
  8. package/dist/contexts/FetchContext.d.ts.map +1 -0
  9. package/dist/contexts/FetchContext.js +63 -0
  10. package/dist/contexts/FetchContext.js.map +1 -0
  11. package/dist/contexts/ReqraftContext.d.ts +9 -0
  12. package/dist/contexts/ReqraftContext.d.ts.map +1 -0
  13. package/dist/contexts/ReqraftContext.js +11 -0
  14. package/dist/contexts/ReqraftContext.js.map +1 -0
  15. package/dist/contexts/StorageContext.d.ts +11 -0
  16. package/dist/contexts/StorageContext.d.ts.map +1 -0
  17. package/dist/contexts/StorageContext.js +17 -0
  18. package/dist/contexts/StorageContext.js.map +1 -0
  19. package/dist/hooks/useFetch/useFetch.d.ts +21 -0
  20. package/dist/hooks/useFetch/useFetch.d.ts.map +1 -0
  21. package/dist/hooks/useFetch/useFetch.js +106 -0
  22. package/dist/hooks/useFetch/useFetch.js.map +1 -0
  23. package/dist/hooks/useReqraftProperty.d.ts +3 -0
  24. package/dist/hooks/useReqraftProperty.d.ts.map +1 -0
  25. package/dist/hooks/useReqraftProperty.js +16 -0
  26. package/dist/hooks/useReqraftProperty.js.map +1 -0
  27. package/dist/hooks/useStorage/useStorage.d.ts +8 -0
  28. package/dist/hooks/useStorage/useStorage.d.ts.map +1 -0
  29. package/dist/hooks/useStorage/useStorage.js +22 -0
  30. package/dist/hooks/useStorage/useStorage.js.map +1 -0
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +10 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/providers/FetchProvider.d.ts +6 -0
  36. package/dist/providers/FetchProvider.d.ts.map +1 -0
  37. package/dist/providers/FetchProvider.js +112 -0
  38. package/dist/providers/FetchProvider.js.map +1 -0
  39. package/dist/providers/ReqraftProvider.d.ts +10 -0
  40. package/dist/providers/ReqraftProvider.d.ts.map +1 -0
  41. package/dist/providers/ReqraftProvider.js +15 -0
  42. package/dist/providers/ReqraftProvider.js.map +1 -0
  43. package/dist/providers/StorageProvider.d.ts +6 -0
  44. package/dist/providers/StorageProvider.d.ts.map +1 -0
  45. package/dist/providers/StorageProvider.js +55 -0
  46. package/dist/providers/StorageProvider.js.map +1 -0
  47. package/dist/utils/fetch.d.ts +22 -0
  48. package/dist/utils/fetch.d.ts.map +1 -0
  49. package/dist/utils/fetch.js +140 -0
  50. package/dist/utils/fetch.js.map +1 -0
  51. package/package.json +8 -3
  52. package/src/components/menu/Menu.stories.tsx +73 -0
  53. package/src/components/menu/Menu.tsx +244 -0
  54. package/src/contexts/FetchContext.tsx +25 -0
  55. package/src/contexts/ReqraftContext.tsx +16 -0
  56. package/src/contexts/StorageContext.tsx +33 -0
  57. package/src/hooks/useFetch/useFetch.stories.tsx +123 -0
  58. package/src/hooks/useFetch/useFetch.tsx +71 -0
  59. package/src/hooks/useReqraftProperty.ts +16 -0
  60. package/src/hooks/useStorage/useStorage.stories.tsx +84 -0
  61. package/src/hooks/useStorage/useStorage.ts +30 -0
  62. package/src/index.tsx +11 -0
  63. package/src/providers/FetchProvider.tsx +62 -0
  64. package/src/providers/ReqraftProvider.tsx +33 -0
  65. package/src/providers/StorageProvider.tsx +80 -0
  66. package/src/utils/fetch.ts +121 -0
  67. package/.eslintrc.js +0 -40
  68. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  69. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  70. package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
  71. package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
  72. package/.github/workflows/beta_release.yml +0 -108
  73. package/.github/workflows/tests.yml +0 -120
  74. package/.prettierrc +0 -7
  75. package/build-storybook.log +0 -28
  76. package/dist/components/form/fields/string/String.stories.d.ts +0 -10
  77. package/dist/components/form/fields/string/String.stories.d.ts.map +0 -1
  78. package/dist/components/form/fields/string/String.stories.js +0 -21
  79. package/dist/components/form/fields/string/String.stories.js.map +0 -1
  80. package/public/logo-dark.png +0 -0
  81. package/public/logo.png +0 -0
  82. package/public/q-symbol-small.png +0 -0
  83. package/public/q-symbol.png +0 -0
  84. package/public/qoreLogo-dark.png +0 -0
  85. package/public/qoreLogo.png +0 -0
  86. package/src/icons.json +0 -2295
  87. package/tests.json +0 -1
  88. package/tsconfig.prod.json +0 -26
@@ -0,0 +1,62 @@
1
+ import { useQueryClient } from '@tanstack/react-query';
2
+ import { useState } from 'react';
3
+ import { useEffectOnce } from 'react-use';
4
+ import { FetchContext, TReqraftContextQueryConfig } from '../contexts/FetchContext';
5
+ import { useReqraftProperty } from '../hooks/useReqraftProperty';
6
+ import { query, setupFetch } from '../utils/fetch';
7
+
8
+ export interface IReqraftFetchProviderProps {
9
+ children: React.ReactNode;
10
+ }
11
+
12
+ export const ReqraftFetchProvider = ({ children }: IReqraftFetchProviderProps) => {
13
+ const queryClient = useQueryClient();
14
+ const instance = useReqraftProperty('instance');
15
+ const instanceToken = useReqraftProperty('instanceToken');
16
+ const instanceUnauthorizedRedirect = useReqraftProperty('instanceUnauthorizedRedirect');
17
+
18
+ const [ready, setReady] = useState(false);
19
+
20
+ useEffectOnce(() => {
21
+ setupFetch({
22
+ instance,
23
+ instanceToken,
24
+ unauthorizedRedirect: instanceUnauthorizedRedirect,
25
+ });
26
+
27
+ setReady(true);
28
+ });
29
+
30
+ if (!ready) {
31
+ return null;
32
+ }
33
+
34
+ async function get<T>(config: TReqraftContextQueryConfig) {
35
+ return query<T>({ queryClient, ...config, method: 'GET' });
36
+ }
37
+
38
+ async function post<T>(config: TReqraftContextQueryConfig) {
39
+ return query<T>({ queryClient, ...config, method: 'POST' });
40
+ }
41
+
42
+ async function put<T>(config: TReqraftContextQueryConfig) {
43
+ return query<T>({ queryClient, ...config, method: 'PUT' });
44
+ }
45
+
46
+ async function del<T>(config: TReqraftContextQueryConfig) {
47
+ return query<T>({ queryClient, ...config, method: 'DELETE' });
48
+ }
49
+
50
+ return (
51
+ <FetchContext.Provider
52
+ value={{
53
+ get,
54
+ post,
55
+ put,
56
+ del,
57
+ }}
58
+ >
59
+ {children}
60
+ </FetchContext.Provider>
61
+ );
62
+ };
@@ -0,0 +1,33 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { ReactNode } from 'react';
3
+ import { IReqraftContext, ReqraftContext } from '../contexts/ReqraftContext';
4
+ import { ReqraftFetchProvider } from './FetchProvider';
5
+ import { ReqraftStorageProvider } from './StorageProvider';
6
+
7
+ export const ReqraftQueryClient = new QueryClient();
8
+
9
+ export interface IReqraftProviderProps extends IReqraftContext {
10
+ children: ReactNode;
11
+ reactQueryClient?: QueryClient;
12
+ }
13
+
14
+ export const ReqraftProvider = ({
15
+ appName,
16
+ children,
17
+ instance,
18
+ instanceToken,
19
+ instanceUnauthorizedRedirect,
20
+ reactQueryClient,
21
+ }: IReqraftProviderProps) => {
22
+ return (
23
+ <ReqraftContext.Provider
24
+ value={{ appName, instanceToken, instance, instanceUnauthorizedRedirect }}
25
+ >
26
+ <QueryClientProvider client={reactQueryClient || ReqraftQueryClient}>
27
+ <ReqraftFetchProvider>
28
+ <ReqraftStorageProvider>{children}</ReqraftStorageProvider>
29
+ </ReqraftFetchProvider>
30
+ </QueryClientProvider>
31
+ </ReqraftContext.Provider>
32
+ );
33
+ };
@@ -0,0 +1,80 @@
1
+ import { cloneDeep, get, set } from 'lodash';
2
+ import { ReactNode, useEffect, useState } from 'react';
3
+ import type { Get } from 'type-fest';
4
+ import { ReqraftStorageContext, TReqraftStorage } from '../contexts/StorageContext';
5
+ import { useFetch } from '../hooks/useFetch/useFetch';
6
+ import { useReqraftProperty } from '../hooks/useReqraftProperty';
7
+ import { TReqraftStorageValue } from '../hooks/useStorage/useStorage';
8
+
9
+ export interface IReqraftStorageProviderProps {
10
+ children: ReactNode;
11
+ }
12
+
13
+ export const ReqraftStorageProvider = ({ children }: IReqraftStorageProviderProps) => {
14
+ const appName = useReqraftProperty('appName');
15
+
16
+ const { data, loading } = useFetch({
17
+ url: 'users/_current_/storage',
18
+ cache: false,
19
+ loadOnMount: true,
20
+ });
21
+
22
+ const { load } = useFetch({
23
+ url: 'users/_current_/',
24
+ method: 'PUT',
25
+ cache: false,
26
+ });
27
+
28
+ const [storage, setStorage] = useState<TReqraftStorage>(data);
29
+
30
+ useEffect(() => {
31
+ if (data) {
32
+ setStorage(data);
33
+ }
34
+ }, [data]);
35
+
36
+ const getStorage = function <T extends TReqraftStorageValue>(
37
+ path: string,
38
+ defaultValue: T,
39
+ includeAppPrefix: boolean = true
40
+ ): Get<TReqraftStorage, string> {
41
+ const _path = includeAppPrefix ? `${appName}.${path}` : path;
42
+
43
+ return get(storage, _path) ?? defaultValue;
44
+ };
45
+
46
+ const updateStorage = function <T extends TReqraftStorageValue>(
47
+ path: string,
48
+ value: T,
49
+ includeAppPrefix: boolean = true
50
+ ) {
51
+ const _path = includeAppPrefix ? `${appName}.${path}` : path;
52
+ const updatedStorage = set(cloneDeep(storage), _path, value);
53
+
54
+ setStorage(updatedStorage);
55
+
56
+ load({ body: { storage: updatedStorage } });
57
+ };
58
+
59
+ const removeStorageValue = function (path: string, includeAppPrefix: boolean = true) {
60
+ const _path = includeAppPrefix ? `${appName}.${path}` : path;
61
+
62
+ const updatedStorage = set(cloneDeep(storage), _path, null);
63
+
64
+ setStorage(updatedStorage);
65
+
66
+ load({ body: { storage_path: _path } });
67
+ };
68
+
69
+ if (loading || !storage) {
70
+ return null;
71
+ }
72
+
73
+ return (
74
+ <ReqraftStorageContext.Provider
75
+ value={{ storage, getStorage, updateStorage, removeStorageValue }}
76
+ >
77
+ {children}
78
+ </ReqraftStorageContext.Provider>
79
+ );
80
+ };
@@ -0,0 +1,121 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { ReqraftQueryClient } from '../providers/ReqraftProvider';
3
+
4
+ export interface IReqraftFetchConfig {
5
+ instance: string;
6
+ instanceToken: string;
7
+ unauthorizedRedirect?: (pathname: string) => string;
8
+ }
9
+
10
+ export interface IReqraftFetchResponse<T> {
11
+ data: T;
12
+ ok: boolean;
13
+ code?: number;
14
+ error?: any;
15
+ }
16
+
17
+ const fetchConfig: IReqraftFetchConfig = {
18
+ instance: window.location.origin + '/',
19
+ instanceToken: '',
20
+ unauthorizedRedirect: (pathname: string) => `/?next=${pathname}`,
21
+ };
22
+
23
+ const CACHE_EXPIRATION_TIME = 5 * 60 * 1000; // 5 minutes
24
+
25
+ export const setupFetch = ({
26
+ instance,
27
+ instanceToken,
28
+ unauthorizedRedirect,
29
+ }: IReqraftFetchConfig) => {
30
+ fetchConfig.instance = instance;
31
+ fetchConfig.instanceToken = instanceToken;
32
+
33
+ if (unauthorizedRedirect) {
34
+ fetchConfig.unauthorizedRedirect = unauthorizedRedirect;
35
+ }
36
+ };
37
+
38
+ async function doFetchData(
39
+ url: string,
40
+ method = 'GET',
41
+ body?: { [key: string]: any }
42
+ ): Promise<Response> {
43
+ if (!fetchConfig.instanceToken) {
44
+ return new Response(JSON.stringify({}), {
45
+ status: 401,
46
+ statusText: 'Unauthorized',
47
+ });
48
+ }
49
+
50
+ return fetch(`${fetchConfig.instance}api/latest/${url}`, {
51
+ method,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ Authorization: `Bearer ${fetchConfig.instanceToken}`,
55
+ },
56
+ body: JSON.stringify(body),
57
+ }).catch((error) => {
58
+ return new Response(JSON.stringify({}), {
59
+ status: 500,
60
+ statusText: `Request failed ${error.message}`,
61
+ });
62
+ });
63
+ }
64
+
65
+ export interface IReqraftQueryConfig {
66
+ url: string;
67
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
68
+ body?: Record<string | number, any>;
69
+ cache?: boolean;
70
+ queryClient?: QueryClient;
71
+ }
72
+
73
+ export async function query<T>({
74
+ url,
75
+ method = 'GET',
76
+ body,
77
+ cache = true,
78
+ queryClient = ReqraftQueryClient,
79
+ }: IReqraftQueryConfig): Promise<IReqraftFetchResponse<T>> {
80
+ const shouldCache = method === 'DELETE' || method === 'POST' ? false : cache;
81
+ const cacheKey = `${url}:${method}:${JSON.stringify(body || {})}`;
82
+
83
+ const requestData = await queryClient.fetchQuery({
84
+ queryKey: [cacheKey],
85
+ queryFn: async () => {
86
+ const response = await doFetchData(url, method, body);
87
+
88
+ const clone = response.clone();
89
+ const json = await clone.json();
90
+
91
+ if (response.status === 401) {
92
+ window.location.href = fetchConfig.unauthorizedRedirect(window.location.pathname);
93
+ }
94
+
95
+ return {
96
+ data: json,
97
+ ok: response.ok,
98
+ status: response.status,
99
+ statusText: response.statusText,
100
+ };
101
+ },
102
+ staleTime: shouldCache ? CACHE_EXPIRATION_TIME : 0,
103
+ });
104
+
105
+ if (!requestData.ok) {
106
+ queryClient.invalidateQueries({ queryKey: [cacheKey] });
107
+
108
+ return {
109
+ data: null,
110
+ ok: false,
111
+ code: requestData.status,
112
+ error: requestData.statusText,
113
+ };
114
+ }
115
+
116
+ return {
117
+ data: requestData.data,
118
+ ok: true,
119
+ code: requestData.status,
120
+ };
121
+ }
package/.eslintrc.js DELETED
@@ -1,40 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: [
7
- 'eslint:recommended',
8
- 'plugin:@typescript-eslint/recommended',
9
- 'plugin:react/recommended',
10
- 'plugin:react/jsx-runtime',
11
- ],
12
- overrides: [
13
- {
14
- env: {
15
- node: true,
16
- },
17
- files: ['.eslintrc.{js,cjs}'],
18
- parserOptions: {
19
- sourceType: 'script',
20
- },
21
- },
22
- ],
23
- parser: '@typescript-eslint/parser',
24
- parserOptions: {
25
- ecmaVersion: 'latest',
26
- sourceType: 'module',
27
- },
28
- plugins: ['@typescript-eslint', 'react'],
29
- rules: {
30
- 'linebreak-style': ['error', 'unix'],
31
- semi: ['error', 'always'],
32
- '@typescript-eslint/no-explicit-any': 'off',
33
- 'react/display-name': 'off',
34
- 'react/prop-types': 'off',
35
- 'no-extra-boolean-cast': 'off',
36
- 'no-console': ['error', { allow: ['warn', 'error'] }],
37
- },
38
- // Ignore storybook files
39
- ignorePatterns: ['**/stories/*', '**/mock/*'],
40
- };
@@ -1,38 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: "[BUG] "
5
- labels: bug
6
- assignees: Foxhoundn
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
- - OS: [e.g. iOS]
28
- - Browser [e.g. chrome, safari]
29
- - Version [e.g. 22]
30
-
31
- **Smartphone (please complete the following information):**
32
- - Device: [e.g. iPhone6]
33
- - OS: [e.g. iOS8.1]
34
- - Browser [e.g. stock browser, safari]
35
- - Version [e.g. 22]
36
-
37
- **Additional context**
38
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: "[ENHANCEMENT] "
5
- labels: enhancement
6
- assignees: Foxhoundn
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: New component
3
- about: New component suggestion
4
- title: "[NEW COMPONENT]"
5
- labels: enhancement
6
- assignees: Foxhoundn
7
-
8
- ---
9
-
10
- **Component name**
11
- What should the component be named? Use self-describing name
12
-
13
- **Component purpose**
14
- Describe thoroughly the purpose of the suggested / proposed component.
15
-
16
- **Component reference**
17
- Is there another library already using this kind of the component?
18
-
19
- **Screenshot / Draft of the component**
20
- Add visual representation of the component if there is any
@@ -1,38 +0,0 @@
1
- ---
2
- name: Visual bug report
3
- about: Create a report to help us improve
4
- title: "[VISUAL BUG]"
5
- labels: bug
6
- assignees: Foxhoundn
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
- - OS: [e.g. iOS]
28
- - Browser [e.g. chrome, safari]
29
- - Version [e.g. 22]
30
-
31
- **Smartphone (please complete the following information):**
32
- - Device: [e.g. iPhone6]
33
- - OS: [e.g. iOS8.1]
34
- - Browser [e.g. stock browser, safari]
35
- - Version [e.g. 22]
36
-
37
- **Additional context**
38
- Add any other context about the problem here.
@@ -1,108 +0,0 @@
1
- # This is a basic workflow to help you get started with Actions
2
-
3
- name: Beta release
4
-
5
- # Controls when the action will run. Triggers the workflow on push or pull request
6
- # events but only for the develop branch
7
- on:
8
- push:
9
- branches:
10
- - develop
11
-
12
- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
13
- jobs:
14
- Publish-and-release:
15
- # The type of runner that the job will run on
16
- runs-on: ubuntu-latest
17
-
18
- # Steps represent a sequence of tasks that will be executed as part of the job
19
- steps:
20
- - name: Get current time
21
- uses: josStorer/get-current-time@v2.0.2
22
- id: current_time
23
- with:
24
- format: YYYYMMDD-HH
25
- utcOffset: '+01:00'
26
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27
- # Checkout the repo
28
- - uses: actions/checkout@v3
29
- with:
30
- fetch-depth: 0
31
- ref: ${{ github.event.pull_request.head.sha }}
32
-
33
- # Get commit message
34
- - name: Print head git commit message
35
- id: get_head_commit_message
36
- run: echo "::set-output name=HEAD_COMMIT_MESSAGE::$(git show -s --format=%s)"
37
-
38
- - uses: actions/setup-node@v3
39
- with:
40
- node-version: 20.11.0
41
-
42
- - name: Save release version to outputs
43
- id: save_release_version
44
- run: echo ::set-output name=version::$(node -pe "require('./package.json').version")
45
-
46
- - name: Installing modules
47
- id: install_modules
48
- run: |
49
- yarn cache clean
50
- rm -rf node_modules
51
- yarn install
52
-
53
- - name: Running tests
54
- id: tests
55
- run: yarn test:ci
56
-
57
- - name: Build
58
- id: build
59
- run: yarn build
60
-
61
- - name: Publish to NPM
62
- id: npm_publish
63
- uses: JS-DevTools/npm-publish@v1
64
- with:
65
- token: ${{ secrets.NPM_TOKEN }}
66
- tag: beta
67
- access: public
68
-
69
- - name: Publish to Chromatic
70
- id: chromatic_publish
71
- uses: chromaui/action@v1
72
- with:
73
- token: ${{ secrets.GITHUB_TOKEN }}
74
- projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
75
-
76
- - name: Create a release
77
- id: release
78
- uses: actions/create-release@v1
79
- env:
80
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81
- with:
82
- tag_name: v${{ steps.save_release_version.outputs.version }}
83
- release_name: v${{ steps.save_release_version.outputs.version }}
84
- body: v${{ steps.save_release_version.outputs.version }}
85
- draft: false
86
- prerelease: false
87
-
88
- # Notify discord if success
89
- - name: Discord notification
90
- env:
91
- DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}}
92
- DISCORD_EMBEDS: '[{"author": {"icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}"}, "url": "https://github.com/${{github.repository}}/commit/${{github.sha}}", "fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{"name": "Repository","value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})","inline": true},{"name": "Branch","value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})","inline": true},{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{"name": "Author","value": "[${{github.actor}}](https://github.com/${{github.actor}})","inline": true},{ "name": "Job", "value": "${{github.job}}", "inline": true },{ "name": "Version", "value": "v${{ steps.save_release_version.outputs.version }}", "inline": true},{"name": "","value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}}) 📙 [Documentation](${{ steps.chromatic_publish.outputs.storybookUrl }}) 🎨 [Chromatic Tests](${{ steps.chromatic_publish.outputs.buildUrl }})"}],"color": 65280,"footer": { "text": "Published at ${{steps.current_time.outputs.readableTime}}" }}]'
93
- DISCORD_AVATAR: 'https://github.com/qoretechnologies/reqore/blob/ae8ce24b7f0984340bf4e6835025d203d1741b3a/public/q-symbol-small.png?raw=true'
94
- uses: Ilshidur/action-discord@0.3.2
95
- with:
96
- args: ':white_check_mark: ReQraft beta v${{ steps.save_release_version.outputs.version }} successfuly released & published.'
97
- if: success()
98
-
99
- # Notify discord if failure
100
- - name: Discord notification
101
- env:
102
- DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}}
103
- DISCORD_EMBEDS: '[{"author": {"icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}"}, "url": "https://github.com/${{github.repository}}/commit/${{github.sha}}", "fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{"name": "Repository","value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})","inline": true},{"name": "Branch","value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})","inline": true},{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{"name": "Author","value": "[${{github.actor}}](https://github.com/${{github.actor}})","inline": true},{ "name": "Job", "value": "${{github.job}}", "inline": true },{ "name": "Version", "value": "v${{ steps.save_release_version.outputs.version }}", "inline": true},{"name": "","value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}})"}],"color": 16711680,"footer": { "text": "Triggered at ${{steps.current_time.outputs.readableTime}}" }}]'
104
- DISCORD_AVATAR: 'https://github.com/qoretechnologies/reqore/blob/ae8ce24b7f0984340bf4e6835025d203d1741b3a/public/q-symbol-small.png?raw=true'
105
- uses: Ilshidur/action-discord@0.3.2
106
- with:
107
- args: ':exclamation: ReQraft beta v${{ steps.save_release_version.outputs.version }} release failed! Click the GitHub Action link below to find out why.'
108
- if: failure()