Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
430 commits
Select commit Hold shift + click to select a range
dc734a6
chore: update tolerance
Anxhul10 Jul 18, 2025
198bef1
chore: add timeout config
Anxhul10 Jul 21, 2025
74fb487
chore: add data display with selection ref"
Anxhul10 Jul 21, 2025
aa542a9
chore: skip PaginatedSelectFilter Normal, Errored, Disabled
Anxhul10 Jul 21, 2025
7f8545e
chore: remove delay hook
Anxhul10 Jul 21, 2025
6307f49
chore: add chrome tolerance
Anxhul10 Jul 22, 2025
63fe6f8
chore: update snapshot of data display & skip paginated
Anxhul10 Jul 22, 2025
6185ed1
chore: remove refs
Anxhul10 Jul 22, 2025
16808ae
chore: unskip paginated
Anxhul10 Jul 22, 2025
dc25024
chore: add new refs and
Anxhul10 Jul 22, 2025
6732b23
chore: remove yarn cache actions
Anxhul10 Jul 22, 2025
6b9b40c
refactor: sync function init
Anxhul10 Jul 22, 2025
7184c3a
chore: remove loadtimeout
Anxhul10 Jul 23, 2025
35157d0
refactor: iterate async function in loop
Anxhul10 Jul 23, 2025
2a9ff29
chore: add function call
Anxhul10 Jul 23, 2025
3390791
chore: async await execa
Anxhul10 Jul 23, 2025
dc5d1e6
chore: test
Anxhul10 Jul 23, 2025
a5a7baf
chore: test
Anxhul10 Jul 23, 2025
1bc5699
chore: chrome flags
Anxhul10 Jul 23, 2025
f5228bf
chore: update new refs according to chrome flags
Anxhul10 Jul 23, 2025
a8d6633
chore: add await in fucntion usage
Anxhul10 Jul 23, 2025
bf14dd8
chore: test script
Anxhul10 Jul 23, 2025
8dd79db
fix syntax
Anxhul10 Jul 23, 2025
3ae0bb4
refactor: loki function
Anxhul10 Jul 24, 2025
4952e70
chore: use child process
Anxhul10 Jul 24, 2025
d1e5042
chore: no shell
Anxhul10 Jul 25, 2025
172a235
chore: remove script
Anxhul10 Jul 25, 2025
a83d7a6
chore: step to log regex object from action
Anxhul10 Jul 25, 2025
201bb79
chore: add output of regex of storybook packages
Anxhul10 Jul 25, 2025
889d45f
fix: use key in object
Anxhul10 Jul 25, 2025
9ce845e
chore: strigify output
Anxhul10 Jul 25, 2025
4f92a43
chore: add various method to access value according to key
Anxhul10 Jul 25, 2025
ac3aa3e
chore: update
Anxhul10 Jul 25, 2025
88c54a2
chore: remove script from step
Anxhul10 Jul 25, 2025
474ca8f
test output
Anxhul10 Jul 26, 2025
c0c7fb1
chore: update
Anxhul10 Jul 26, 2025
bd628a2
update
Anxhul10 Jul 26, 2025
c846062
update
Anxhul10 Jul 26, 2025
a2ce2c2
chore: if else init
Anxhul10 Jul 26, 2025
5238e40
update
Anxhul10 Jul 26, 2025
7c85dba
update
Anxhul10 Jul 26, 2025
4800a4b
update
Anxhul10 Jul 26, 2025
f01554b
update
Anxhul10 Jul 26, 2025
624995c
fix if
Anxhul10 Jul 26, 2025
023ae3f
update
Anxhul10 Jul 26, 2025
9b4cdd9
fix
Anxhul10 Jul 26, 2025
acff5ce
fix: typo
Anxhul10 Jul 26, 2025
a0553a0
chore: add cli cmds
Anxhul10 Jul 26, 2025
0c50d4b
chore: run steps even previous step failed
Anxhul10 Jul 26, 2025
c808493
fix: skipping packages file on smart test
Anxhul10 Jul 26, 2025
a78e67d
chore: add logs for skipping pakcage test
Anxhul10 Jul 26, 2025
b4c4ff0
Merge pull request #53 from Anxhul10/chore/actions-step
Anxhul10 Jul 27, 2025
0243204
fix: synatx bash
Anxhul10 Jul 27, 2025
7465357
chore: rocket thruster init
Anxhul10 Jul 27, 2025
68d23e4
chore: use if in full test
Anxhul10 Jul 27, 2025
f19030c
update
Anxhul10 Jul 27, 2025
02b1167
chore: swap if and elif
Anxhul10 Jul 27, 2025
6ba1ef4
add sudo
Anxhul10 Jul 27, 2025
1dc043a
chore: resolve-loki-init
Anxhul10 Jul 29, 2025
d292d23
chore: add loki to update readme
Anxhul10 Jul 29, 2025
06417a8
chore: revive loki scripts
Anxhul10 Jul 29, 2025
8869587
chore: revive scripts and add to new packages
Anxhul10 Jul 29, 2025
cb9e489
chore: add custom docker flag in script
Anxhul10 Jul 29, 2025
9c3a6f7
chore: update refs
Anxhul10 Jul 29, 2025
d63a945
chore: update refs
Anxhul10 Jul 29, 2025
ff42f0c
chore: remove custom docker on data argument must be of type string o…
Anxhul10 Jul 29, 2025
db8f990
refactor: use script
Anxhul10 Jul 29, 2025
f567ccc
fix: error on runner diffs use docker wihtout sec comp
Anxhul10 Jul 30, 2025
2b3eb60
fix: yukinying/chrome-headless-browser-stable version typo
Anxhul10 Jul 30, 2025
5614734
chore: update yukinying/chrome-headless-browser-stable version
Anxhul10 Jul 30, 2025
ceabf65
fix: permission tsconfig
Anxhul10 Jul 30, 2025
b0fe89b
fix: lint error :
Anxhul10 Jul 30, 2025
18b0331
Merge pull request #57 from Anxhul10/chore/tools-custom-docker-init
Anxhul10 Jul 30, 2025
9f4a027
chore: add flag --chromeDockerWithoutSeccomp
Anxhul10 Jul 30, 2025
cd27386
chore: remove remote caching
Anxhul10 Jul 30, 2025
3cc8347
chore: add remote caching
Anxhul10 Jul 30, 2025
e2fefb9
chore: update refs
Anxhul10 Jul 31, 2025
c2ba282
chore: update refs
Anxhul10 Jul 31, 2025
eaa6fe6
chore: actions init
Anxhul10 Jul 31, 2025
c17ae50
chore: trigger job
Anxhul10 Jul 31, 2025
0660d62
chore: remove needs
Anxhul10 Jul 31, 2025
ba6011c
chore: remove step
Anxhul10 Jul 31, 2025
faaf0c4
fix: download artifact
Anxhul10 Jul 31, 2025
0fe95be
show directory
Anxhul10 Jul 31, 2025
3884ea4
update
Anxhul10 Jul 31, 2025
d7423cc
chore: add fetch depth
Anxhul10 Jul 31, 2025
05960c0
chore: add build step
Anxhul10 Jul 31, 2025
54294ed
chore: update
Anxhul10 Jul 31, 2025
4ad4e66
update
Anxhul10 Jul 31, 2025
2b15013
Merge pull request #59 from Anxhul10/refactor/actions
Anxhul10 Jul 31, 2025
b258873
chore: lint init
Anxhul10 Jul 31, 2025
3255ff8
refactor: for loop
Anxhul10 Jul 31, 2025
bfe4d42
Merge pull request #61 from Anxhul10/chore/lint
Anxhul10 Jul 31, 2025
45dff99
chore: add scripts
Anxhul10 Jul 31, 2025
4f82b6d
update
Anxhul10 Jul 31, 2025
84fbbe0
update
Anxhul10 Jul 31, 2025
b393b5b
update
Anxhul10 Jul 31, 2025
3a60a8e
chore: add scripts for storybook packages
Anxhul10 Jul 31, 2025
dbfbf3c
update
Anxhul10 Jul 31, 2025
e953a7f
chore: remove logs
Anxhul10 Jul 31, 2025
b221aaf
chore: rename action
Anxhul10 Jul 31, 2025
dc21419
chore: remove name:
Anxhul10 Jul 31, 2025
20d9202
chore: add chrometolerance
Anxhul10 Jul 31, 2025
fd89417
refactor: runner to getAffectedComponents
Anxhul10 Jul 31, 2025
5172e1b
fix: lint errors
Anxhul10 Jul 31, 2025
7470066
update tolerance
Anxhul10 Jul 31, 2025
428e017
update tolerance
Anxhul10 Jul 31, 2025
211054a
update tolerance
Anxhul10 Jul 31, 2025
7c9d6aa
update tolerance
Anxhul10 Jul 31, 2025
bb4dac8
0.06 -> 0.0006
Anxhul10 Jul 31, 2025
2e227a8
Update package.json
Anxhul10 Jul 31, 2025
a70fea3
0.07 -> 0.08
Anxhul10 Aug 1, 2025
818ecdf
update tolerance"
Anxhul10 Aug 1, 2025
2dc37d8
chore: remove docker flag
Anxhul10 Aug 1, 2025
b622ce9
chore: update feedback
Anxhul10 Aug 1, 2025
7d00154
chore: update Feedback refs
Anxhul10 Aug 1, 2025
6459e14
chore: remove tolerance
Anxhul10 Aug 1, 2025
902d069
chore: build storybook in loki step
Anxhul10 Aug 1, 2025
0daf847
Merge pull request #62 from Anxhul10/chore/smart-action-init
Anxhul10 Aug 2, 2025
598c559
chore: remove build-storybook at loki step and add download artifact…
Anxhul10 Aug 3, 2025
f1be0b2
chore: update package name
Anxhul10 Aug 3, 2025
5a7c282
chore: add refs and use chinello/alpine-chrome:93
Anxhul10 Aug 4, 2025
e578ef9
chore: add Dockerfile
Anxhul10 Aug 4, 2025
6ba2c4b
chore: add entrypoint
Anxhul10 Aug 4, 2025
5234832
fix: docker image pass action
Anxhul10 Aug 4, 2025
4689464
fix: lint errors
Anxhul10 Aug 4, 2025
35c8515
chore: run node in docker
Anxhul10 Aug 4, 2025
4c8bb49
chore: checking loki test in docker action
Anxhul10 Aug 4, 2025
e6eaa0f
chore: docker action
Anxhul10 Aug 4, 2025
7337563
chore: use default docker image
Anxhul10 Aug 4, 2025
4ce06cb
chore: add root usr
Anxhul10 Aug 4, 2025
8ec6c90
chore: add yarn
Anxhul10 Aug 4, 2025
e7f2051
update
Anxhul10 Aug 4, 2025
8828dd4
chore: debug
Anxhul10 Aug 4, 2025
1ec0344
update
Anxhul10 Aug 4, 2025
88ca0df
update
Anxhul10 Aug 4, 2025
06c4bd7
chore: update:
Anxhul10 Aug 4, 2025
df4f080
test
Anxhul10 Aug 4, 2025
6486a2a
udpate
Anxhul10 Aug 4, 2025
a8f1811
chore: yarn version 1.22.19
Anxhul10 Aug 4, 2025
3cb92d4
chore: add ci cmd
Anxhul10 Aug 4, 2025
44e62dc
update
Anxhul10 Aug 4, 2025
873d93d
use origin docker image headless
Anxhul10 Aug 6, 2025
b0d0d8c
chore: revive docker test
Anxhul10 Aug 7, 2025
eee38e8
fix: yoga layout error
Anxhul10 Aug 7, 2025
38ba23a
fix: use correct docker image
Anxhul10 Aug 7, 2025
68ca1fc
chore: use 123 node
Anxhul10 Aug 7, 2025
344877e
update
Anxhul10 Aug 7, 2025
4faafcb
chore: update refs
Anxhul10 Aug 7, 2025
2da8f77
chore: remove chrome concurrency causes error and increases the CI time
Anxhul10 Aug 7, 2025
3437b6c
try: to fix fail test
Anxhul10 Aug 7, 2025
b2670c3
chore: full access to create folder
Anxhul10 Aug 7, 2025
d84bf8e
chore: non root user
Anxhul10 Aug 7, 2025
3254477
update
Anxhul10 Aug 7, 2025
fd7bbdb
update
Anxhul10 Aug 7, 2025
19c51fc
chore: reduce chrome concurrency
Anxhul10 Aug 7, 2025
6d7bded
chore: set chrome concurrency to 1
Anxhul10 Aug 7, 2025
7c4721d
chore: remove refs caugin ambiguity
Anxhul10 Aug 7, 2025
9fd157c
chore: new refs
Anxhul10 Aug 7, 2025
ff1b3d4
fix: merge conflict
Anxhul10 Aug 7, 2025
8dab2d5
fix: staticServer.close is not a function on running chrome.app
Anxhul10 Aug 8, 2025
5fc1330
chore: update lockfile with loki/target-chrome-app patch
Anxhul10 Aug 8, 2025
8ff2a7d
Merge pull request #66 from Anxhul10/chore/fuselageSnap-in-docker
Anxhul10 Aug 8, 2025
d811003
Merge pull request #65 from Anxhul10/chore/fuselageSnap
Anxhul10 Aug 8, 2025
8198797
update
Anxhul10 Aug 8, 2025
4720f5a
chore: update refs
Anxhul10 Aug 8, 2025
d96be44
Merge pull request #73 from Anxhul10/test/paginated
Anxhul10 Aug 8, 2025
f34e98e
refactor: separate docker and js action
Anxhul10 Aug 10, 2025
295af10
chore: op of docker action to js ip test
Anxhul10 Aug 10, 2025
6d03a39
fix: yml syntax
Anxhul10 Aug 10, 2025
ca76f5b
chore: update lockfile due to change in directory structure
Anxhul10 Aug 10, 2025
fa0f76e
test
Anxhul10 Aug 10, 2025
9daadab
fix: js action
Anxhul10 Aug 10, 2025
e7aca09
update
Anxhul10 Aug 10, 2025
e70f549
chore: update paths and include in workspace
Anxhul10 Aug 10, 2025
6ff5240
fix: typo
Anxhul10 Aug 10, 2025
eeffdaa
fix: lint
Anxhul10 Aug 10, 2025
1a4e107
chore: add build
Anxhul10 Aug 10, 2025
558671d
chore: add reset of storybook packages on docker action
Anxhul10 Aug 11, 2025
90d61b1
chore: add inputs in docker action
Anxhul10 Aug 11, 2025
a07b9cd
chore: check logs
Anxhul10 Aug 11, 2025
4962836
chore: add args in docker action of storybook pkgs
Anxhul10 Aug 11, 2025
052efd5
chore: add scripts to run tests
Anxhul10 Aug 11, 2025
a3f3ec8
fix: array in unix bourne shell
Anxhul10 Aug 11, 2025
dfd3bfb
chore: use $$arg
Anxhul10 Aug 11, 2025
53cd964
fix: use args from docker action
Anxhul10 Aug 11, 2025
34c9127
Merge pull request #75 from Anxhul10/chore/docker-js-action
Anxhul10 Aug 11, 2025
976af0c
chore: divide in scripts
Anxhul10 Aug 11, 2025
7e0f36a
chore: add pkg name from steps
Anxhul10 Aug 11, 2025
607c163
chore: remove runs for test
Anxhul10 Aug 11, 2025
adbf2fe
chore: run complete test even step fails
Anxhul10 Aug 11, 2025
e92bfe9
chore: replace refs
Anxhul10 Aug 11, 2025
a88e617
chore: replace refs
Anxhul10 Aug 11, 2025
d6f18c5
chore: update refs in zenika/alpine-chrome docker image
Anxhul10 Aug 11, 2025
a446cc8
fix: path errors
Anxhul10 Aug 11, 2025
4bd0f7b
chore: udpate chrome cuncurrency to 1
Anxhul10 Aug 12, 2025
e742d12
chore: add non stats file logs in core.group
Anxhul10 Aug 12, 2025
de79176
fix: lint
Anxhul10 Aug 12, 2025
80af1b4
chore: log changed file other than storybook pkgs
Anxhul10 Aug 12, 2025
2b0702e
fix: logging grammer
Anxhul10 Aug 12, 2025
e5d29a1
Merge pull request #78 from Anxhul10/chore/core-group
Anxhul10 Aug 12, 2025
29afe06
chore: create file save.json to save non stats file
Anxhul10 Aug 12, 2025
9f1b9d5
fix: plural
Anxhul10 Aug 12, 2025
4c70d1a
chore: add get non stat file name throught webpack
Anxhul10 Aug 12, 2025
53ce9b6
chore: add collapsable to see non stats file
Anxhul10 Aug 12, 2025
45747d0
fix: lint
Anxhul10 Aug 12, 2025
397a1e9
refactor: arrange order of the logs
Anxhul10 Aug 12, 2025
f46904a
fix: lint
Anxhul10 Aug 12, 2025
10b7ee5
update
Anxhul10 Aug 12, 2025
3173338
fix: file replace
Anxhul10 Aug 12, 2025
d0fce90
chore: update
Anxhul10 Aug 12, 2025
f7ee000
fix: lint
Anxhul10 Aug 12, 2025
aa9adcf
Merge pull request #79 from Anxhul10/chore/non-stats-file
Anxhul10 Aug 12, 2025
bf924f4
chore: remove logs
Anxhul10 Aug 12, 2025
fa873a1
Merge pull request #76 from Anxhul10/chore/arrange-steps
Anxhul10 Aug 12, 2025
c458a8c
chore: fuselageSnap local init
Anxhul10 Aug 13, 2025
b48be50
chore: add local changed file
Anxhul10 Aug 13, 2025
001e419
chore: local logs affected components
Anxhul10 Aug 13, 2025
b54e301
fix: lint
Anxhul10 Aug 13, 2025
35cd741
chore: local suppport complete
Anxhul10 Aug 13, 2025
1505c40
chore: remove full test trigger on tools change
Anxhul10 Aug 15, 2025
47e2f45
chore: add promise resolve on exit and fix unterminated quoted string
Anxhul10 Aug 15, 2025
049c921
refactor: used loops instead of if statements
Anxhul10 Aug 15, 2025
1fb7f1a
chore: add build-storybook before fuselageSnap run
Anxhul10 Aug 15, 2025
eeb78c7
update
Anxhul10 Aug 15, 2025
278001a
chore: add scss file support
Anxhul10 Aug 16, 2025
63f0950
fix: lint
Anxhul10 Aug 16, 2025
659a6d3
refactor: used seperate function to get relevant graph
Anxhul10 Aug 16, 2025
0e66395
chore: add transitive dependency
Anxhul10 Aug 16, 2025
bef1d4e
refactor: used own function to merge dependencies
Anxhul10 Aug 16, 2025
dc6d626
chore: build storybook of the affected packages
Anxhul10 Aug 16, 2025
bca3351
chore: add current pkg storybook build
Anxhul10 Aug 16, 2025
5098084
fix: multiple builds at the same packages at same time
Anxhul10 Aug 16, 2025
8b0f514
fix: lint
Anxhul10 Aug 16, 2025
8fa6a3e
chore: remove logs
Anxhul10 Aug 16, 2025
14fbf03
Merge pull request #84 from Anxhul10/chore/scss-support
Anxhul10 Aug 16, 2025
eb742cc
Merge pull request #82 from Anxhul10/chore/minor-improvements
Anxhul10 Aug 16, 2025
9b165c0
Merge pull request #80 from Anxhul10/chore/fuselageSnap-local-support
Anxhul10 Aug 17, 2025
ad3cd87
fix: merge conflicts
Anxhul10 Aug 17, 2025
8dab97e
chore: add refs
Anxhul10 Aug 17, 2025
87976a7
Merge pull request #86 from Anxhul10/fix/merge-conflicts
Anxhul10 Aug 17, 2025
95fbcdd
chore: resolve conflict
Anxhul10 Aug 17, 2025
f41b083
chore: skip dependency graph of webpack compiled modules
Anxhul10 Aug 19, 2025
fe86071
Merge pull request #88 from Anxhul10/chore/optimize-fuselageSnap
Anxhul10 Aug 19, 2025
7107789
fix: skipping of affected components
Anxhul10 Aug 19, 2025
adcd204
fix: lint
Anxhul10 Aug 20, 2025
5005302
Merge branch 'main' into chore/loki
Anxhul10 Aug 27, 2025
2fa8a83
fix: merge conflicts
Anxhul10 Sep 28, 2025
34ded31
chore: update refs
Anxhul10 Sep 28, 2025
d409701
Merge pull request #94 from Anxhul10/chore/update-refs
Anxhul10 Sep 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/actions/loki/fuselageSnap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dump/
dist/
20 changes: 20 additions & 0 deletions .github/actions/loki/fuselageSnap/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: fuselageSnap
inputs:
working_dir:
required: true
default: .
react_uri:
required: true
default: ./storybook-static
outputs:
fuselage:
description: A regex of fuselage components
fuselage-toastbar:
description: A regex of fuselage-toastbar components
layout:
description: A regex of layout components
onboarding-ui:
description: A regex of onboarding-ui components
runs:
using: 'node20'
main: dist/index.js
125 changes: 125 additions & 0 deletions .github/actions/loki/fuselageSnap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { writeFileSync } from 'fs';

import * as core from '@actions/core';
import * as github from '@actions/github';

import { getAffectedComponents } from './src/getAffectedComponents.js';
import { getChangedFile } from './src/git/git.js';
import { readStatsFile } from './src/stats/readStatsFile.js';
import { trimStatsFile } from './src/stats/trimStatsFile.js';
import { copyFiles } from './src/utils/copyFiles.js';
import { generateRegex } from './src/utils/generateRegex.js';

// yarn build-storybook --stats-json gives project-stats.json which has component titles
// where as index.json gives the webpack base dependency graph
// index.js run from the root of the project
const { context } = github;
const filesToCopy = [
{
src: './packages/fuselage/storybook-static/index.json',
dest: '.github/actions/loki/fuselageSnap/dist/fuselage-sb.json',
},
{
src: './packages/fuselage-toastbar/storybook-static/index.json',
dest: '.github/actions/loki/fuselageSnap/dist/fuselage-toastbar-sb.json',
},
{
src: './packages/onboarding-ui/storybook-static/index.json',
dest: '.github/actions/loki/fuselageSnap/dist/onboarding-ui-sb.json',
},
{
src: './packages/layout/storybook-static/index.json',
dest: '.github/actions/loki/fuselageSnap/dist/layout-sb.json',
},
{
src: './packages/fuselage/storybook-static/preview-stats.json',
dest: '.github/actions/loki/fuselageSnap/dist/fuselage-stats.json',
},
{
src: './packages/fuselage-toastbar/storybook-static/preview-stats.json',
dest: '.github/actions/loki/fuselageSnap/dist/fuselage-toastbar-stats.json',
},
{
src: './packages/onboarding-ui/storybook-static/preview-stats.json',
dest: '.github/actions/loki/fuselageSnap/dist/onboarding-ui-stats.json',
},
{
src: './packages/layout/storybook-static/preview-stats.json',
dest: '.github/actions/loki/fuselageSnap/dist/layout-stats.json',
},
];

writeFileSync(
'.github/actions/loki/fuselageSnap/dist/save.json',
'{"file_names":[]}',
function (err) {
if (err) {
return console.log(err);
}
console.log('The file was saved!');
},
);
writeFileSync(
'.github/actions/loki/fuselageSnap/dist/non-storybook-files.json',
'{"file_names":[]}',
function (err) {
if (err) {
return console.log(err);
}
console.log('The file was saved!');
},
);

async function run(context) {
// getTrimmedstats
const promises = [];
for (const { src, dest } of filesToCopy) {
copyFiles(src, dest);
if (dest.includes('stats')) {
const trimmedPath = `.github/actions/loki/fuselageSnap/dist/trimmed-${dest.split('/').slice(-1)}`;
promises.push(trimStatsFile(dest, trimmedPath));
}
}

await Promise.all(promises);
if (context.eventName === 'pull_request') {
const changedFiles = await getChangedFile(context);
const data = await getAffectedComponents(changedFiles);
const regex = generateRegex(data);
const nonStatsFileName = await readStatsFile(
'.github/actions/loki/fuselageSnap/dist/save.json',
);
const nonStryBkFiles = await readStatsFile(
'.github/actions/loki/fuselageSnap/dist/non-storybook-files.json',
);
core.startGroup('click to see the changed files');
console.log(changedFiles);
core.endGroup();
core.startGroup('click to see files that do not appear in storybook stats');
console.log(nonStatsFileName.file_names);
core.startGroup('click to see non storybook package files');
console.log(nonStryBkFiles.file_names);
core.endGroup();
if (regex.fuselage.length === 0) {
regex.fuselage = 'skip';
}
if (regex['fuselage-toastbar'].length === 0) {
regex['fuselage-toastbar'] = 'skip';
}
if (regex.layout.length === 0) {
regex.layout = 'skip';
}
if (regex['onboarding-ui'].length === 0) {
regex['onboarding-ui'] = 'skip';
}
core.setOutput('fuselage', regex.fuselage);
core.setOutput('fuselage-toastbar', regex['fuselage-toastbar']);
core.setOutput('layout', regex.layout);
core.setOutput('onboarding-ui', regex['onboarding-ui']);
} else {
core.error(
'To use Loki fuselagesnap please use trigger events like pull request or push',
);
}
}
run(context);
21 changes: 21 additions & 0 deletions .github/actions/loki/fuselageSnap/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "fuselagesnap",
"version": "0.0.1",
"type": "module",
"scripts": {
"build": "rollup index.js --file dist/index.js",
"lint": "lint",
"lint-and-fix": "lint-and-fix",
"prettier-format": "prettier 'src/**/*.{ts,tsx,js,jsx}' --write"
},
"dependencies": {
"@actions/core": "~1.11.1",
"@actions/github": "~6.0.1",
"@discoveryjs/json-ext": "~0.6.3",
"eslint": "~9.29.0",
"execa": "~9.6.0",
"lint-all": "workspace:~",
"prettier": "~3.5.3",
"rollup": "~4.44.2"
}
}
175 changes: 175 additions & 0 deletions .github/actions/loki/fuselageSnap/src/getAffectedComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { getDirectDependencies } from './getDirectDependencies.js';
import { getIndirectDps } from './getIndirectDependency.js';
import { getNonStatsFile } from './getNonStatsFile.js';

const mapPackagesToFilePath = (changedFiles) => {
const packageToFileMap = {};
for (const filePath of changedFiles) {
if (filePath.split('/').length !== 1) {
try {
const match = filePath.match(/^packages\/([^/]+)/);
const packageName = match[1];
if (match) {
if (!packageToFileMap[packageName]) {
packageToFileMap[packageName] = [];
}
packageToFileMap[packageName].push(filePath);
}
} catch (error) {
console.log('Ensure file path contains packages ');
console.log(error.message);
}
}
}
return packageToFileMap;
};

/**
* @param {Array<Object<string, set<string>>>} saveDirectDps - list of dependent components within the changed package
* @param {Array<Array<Object<string, Set<string>>>>} saveIndirectDps - list of dependent component within dependent packages
* @param {Object<string, string[]>} pkgToFileMap - Mapping of package name to array of changed files.
* @returns {Promise<Object<string, Set<string>>>} - Merged map of package names to their affected component titles.
*/
async function mergeCmpDeps(saveDirectDps, saveIndirectDps, pkgToFileMap) {
const fuselage = new Set();
const fuselageToastbar = new Set();
const onboardingUi = new Set();
const layout = new Set();
for (const parentObj of saveIndirectDps) {
for (const childObj of parentObj) {
const [key, valueSet] = Object.entries(childObj)[0];
if (key === 'fuselage') {
for (const item of valueSet) fuselage.add(item);
} else if (key === 'fuselage-toastbar') {
for (const item of valueSet) fuselageToastbar.add(item);
} else if (key === 'onboarding-ui') {
for (const item of valueSet) onboardingUi.add(item);
} else if (key === 'layout') {
for (const item of valueSet) layout.add(item);
}
}
}
for (const parentObj of saveDirectDps) {
const [key, value] = Object.entries(parentObj)[0];
if (value !== null) {
if (key === 'fuselage') {
for (const cmp of value) fuselage.add(cmp);
} else if (key === 'fuselage-toastbar') {
for (const cmp of value) fuselageToastbar.add(cmp);
} else if (key === 'onboarding-ui') {
for (const cmp of value) onboardingUi.add(cmp);
} else if (key === 'layout') {
for (const cmp of value) layout.add(cmp);
}
}
}
for (const pkg in pkgToFileMap) {
if (Object.prototype.hasOwnProperty.call(pkgToFileMap, pkg)) {
for (const file of pkgToFileMap[pkg]) {
if (file.includes('package.json') || file.includes('.storybook')) {
if (pkg === 'fuselage') {
fuselage.clear();
fuselage.add('full test');
} else if (pkg === 'fuselage-toastbar') {
fuselageToastbar.clear();
fuselageToastbar.add('full test');
} else if (pkg === 'onboarding-ui') {
onboardingUi.clear();
onboardingUi.add('full test');
} else if (pkg === 'layout') {
layout.clear();
layout.add('full test');
} else {
console.log('package does not contain storybook');
}
}
}
}
}
return {
fuselage,
'fuselage-toastbar': fuselageToastbar,
'onboarding-ui': onboardingUi,
layout,
};
}

function potentialFullTest(changedFiles) {
for (const file of changedFiles) {
if (file.includes('yarn.lock')) {
return true;
}
const pkg = file.split('/')[0];
if (pkg.includes('package.json')) {
return true;
}
}
return false;
}
export const getAffectedComponents = async (changedFiles) => {
if (potentialFullTest(changedFiles)) {
const fuselage = new Set();
const fuselageToastbar = new Set();
const onboardingUi = new Set();
const layout = new Set();
fuselage.add('full test');
fuselageToastbar.add('full test');
onboardingUi.add('full test');
layout.add('full test');
return {
fuselage,
'fuselage-toastbar': fuselageToastbar,
'onboarding-ui': onboardingUi,
layout,
};
}

const filterChangedFiles = [];
const unfilteredChangedFiles = [];
for (const file of changedFiles) {
if (file.includes('packages')) {
// SCSS files are not included in the webpack dependency graph.
// If a changed file is a `*.styles.scss` inside `components/`,
// map it to its parent component’s `.tsx` file.
// Example: `Button.styles.scss` → `Button.tsx`
if (file.includes('styles.scss') && file.includes('components')) {
const part = file.split('/');
const replace = part[part.length - 2];
part[part.length - 1] = `${replace}.tsx`;
filterChangedFiles.push(part.join('/'));
} else {
filterChangedFiles.push(file);
}
} else {
unfilteredChangedFiles.push(file);
}
}
const promises = [];
for (const file of unfilteredChangedFiles) {
promises.push(
getNonStatsFile(
file,
'.github/actions/loki/fuselageSnap/dist/non-storybook-files',
),
);
}
await Promise.all(promises);
const map = mapPackagesToFilePath(filterChangedFiles);
const directDepsPromises = [];
const indirectDepsPromises = [];
const pkgNames = [];

for (const pkgName in map) {
if (Object.prototype.hasOwnProperty.call(map, pkgName)) {
pkgNames.push(pkgName);
directDepsPromises.push(getDirectDependencies(map[pkgName], pkgName));
indirectDepsPromises.push(getIndirectDps(pkgName));
}
}

const saveDirectDps = await Promise.all(directDepsPromises);
const saveIndirectDps = await Promise.all(indirectDepsPromises);

const result = await mergeCmpDeps(saveDirectDps, saveIndirectDps, map);
return result;
};
8 changes: 8 additions & 0 deletions .github/actions/loki/fuselageSnap/src/getChangedPackages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const getChangedPackages = (filechanged) => {
const changedPackages = [];
filechanged.forEach((fileName) => {
const dismantle = fileName.split('/');
changedPackages.push(dismantle[1]);
});
return changedPackages;
};
22 changes: 22 additions & 0 deletions .github/actions/loki/fuselageSnap/src/getComponentTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { readStatsFile } from './stats/readStatsFile.js';

/**
*
* @param {string[]} storyNameArray - name or file path from src which includes .stories
* @param {string} changedPackage - current pacakge which is changed
* @returns {promise<Set<string>>} - A Promise that resolves to a set of component titles.
*/
export const getComponentTitle = async (storyNameArray, changedPackage) => {
const indexJSON = await readStatsFile(
`.github/actions/loki/fuselageSnap/dist/${changedPackage}-sb.json`,
);
const componentSet = new Set();
for (const storyName of storyNameArray) {
for (const entry of Object.values(indexJSON.entries)) {
if (entry.importPath === storyName) {
componentSet.add(entry.title);
}
}
}
return componentSet;
};
Loading
Loading