-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.codemod.yaml
More file actions
78 lines (73 loc) · 2.35 KB
/
workflow.codemod.yaml
File metadata and controls
78 lines (73 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# yaml-language-server: $schema=https://raw.githubusercontent.com/codemod/codemod/refs/heads/main/schemas/workflow.json
version: "1"
state:
schema:
shards:
type: array
items:
type: object
properties:
team:
type: string
shard:
type: string
shardId:
type: string
params:
schema:
is_codemod_cloud:
name: "Is Codemod Cloud"
type: boolean
default: false
nodes:
- id: evaluate-shards
name: Evaluate Shards
trigger:
type: automatic
steps:
- name: "Evaluate shards by codeowner"
run: |
npx -y codemodctl@latest shard codeowner -l tsx -c $CODEMOD_PATH/src/codemod.ts -s ${{ params.prSize }} --stateProp shards
- id: apply-transforms
name: Transform CSS-IN-JS to Flex Components
type: automatic
strategy:
type: matrix
from_state: shards
steps:
- name: "Convert styled flex divs to Flex components"
js-ast-grep:
js_file: scripts/codemod.ts
language: "tsx"
# Enable workspace-level semantic analysis for .references()
semantic_analysis: workspace
include:
- "**/*.ts"
- "**/*.tsx"
- "**/*.js"
- "**/*.jsx"
exclude:
- "**/node_modules/**"
- "**/*.test.ts"
- "**/*.test.tsx"
- "**/*.spec.ts"
- "**/*.spec.tsx"
- "**/tests/**"
- name: "AI Review"
if: params.is_codemod_cloud
ai:
max_steps: 500
prompt: |
We just applied a codemod to transform CSS-IN-JS styled components with flex properties to Flex components.
Please review the changes and modify the code as needed.
- name: "Run post-transform fixes"
run: |
echo "run prettier and eslint fix"
- name: "Git push"
if: params.is_codemod_cloud
run: |
npx -y codemodctl@latest git create-pr \
--commitMessage "[DRAFT] refactor: Run $CODEMOD_PROJECT_NAME shard $MATRIX_NAME" \
--title "[DRAFT] refactor: Run $CODEMOD_PROJECT_NAME shard $MATRIX_NAME" \
--body "This is a pull request for the $CODEMOD_PROJECT_NAME campaign targeting $MATRIX_TEAM $MATRIX_DIRECTORY shard $MATRIX_SHARDID $MATRIX_NAME" \
--push