Skip to content

Commit

Permalink
refactor: 🐛 run wr fetch command in the module
Browse files Browse the repository at this point in the history
run wr fetch command in the module

Ref: rxefy/profile-module #25
  • Loading branch information
Swrnv-qc committed Feb 3, 2024
1 parent 89ea7b5 commit b7403b0
Show file tree
Hide file tree
Showing 16 changed files with 35,591 additions and 9,637 deletions.
114 changes: 12 additions & 102 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,106 +1,16 @@
// eslint-disable-next-line no-undef
module.exports = {
"env": {
"browser": true,
"es2021" : true,
"node" : true
},
"extends" : ["eslint:recommended", "plugin:react/recommended", "plugin:import/recommended", "plugin:react/jsx-runtime"],
"ignorePatterns": ["**/node_modules/*"],
"overrides" : [],
"parserOptions" : {
"ecmaVersion": "latest",
"sourceType" : "module",
},
"plugins": [
"etc",
"import",
"react",
"sort-keys-fix",
"unused-imports",
],
"rules": {
"array-bracket-newline": [
"error",
{
"minItems" : 5,
"multiline": true,
},
],
"array-bracket-spacing" : ["error", "never"],
"array-element-newline" : ["error", { "minItems": 5, "multiline": true }],
"comma-dangle" : ["error", { "arrays": "only-multiline", "objects": "only-multiline" }],
"comma-spacing" : ["error", { "after": true, "before": false }],
"etc/no-commented-out-code": "error",
"id-length" : ["error", { "exceptions": ["i", "j", "id"], "min": 3, "properties": "never" }],
"import/order" : [
"error",
{
"alphabetize": {
"caseInsensitive": true,
"order" : "asc",
},
"groups" : ["builtin", "external", "internal"],
"newlines-between": "always",
"pathGroups" : [
{
"group" : "builtin",
"pattern" : "react",
"position": "before",
},
],
"pathGroupsExcludedImportTypes": ["react"],
},
],
"indent" : ["error", 4, { "MemberExpression": 1, "SwitchCase": 1 }],
"key-spacing" : ["error", { "align": "colon" }],
"linebreak-style" : ["error", "unix"],
"newline-after-var" : ["error", "always"],
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
"no-console" : "error",
"no-multi-spaces" : ["error", { exceptions: { "VariableDeclarator": true } }],
"no-multiple-empty-lines" : ["error", { "max": 1 }],
"no-unused-vars" : ["error", { "args": "after-used", "vars": "all" }],
"no-var" : "error",
"object-curly-newline" : [
"error",
{
"ExportDeclaration": { "minProperties": 6, "multiline": true },
"ImportDeclaration": { "minProperties": 6, "multiline": true },
"ObjectExpression" : { "minProperties": 6, "multiline": true },
"ObjectPattern" : { "minProperties": 6, "multiline": true },
},
],
"object-curly-spacing" : ["error", "always"],
"object-property-newline" : ["error", { "allowAllPropertiesOnSameLine": true }],
"padding-line-between-statements": [
"error",
{
blankLine: "always",
next : "*",
prev : ["const", "let", "var"],
ignorePatterns: ["**/node_modules/*", ".eslintrc.js", "commitlint.config.js" ],
overrides: [
{
files: ["service/**/*.js"],
// Extend or merge with the service-specific configuration
...require("./.eslint/service/.eslintrc.js"),
},
{
blankLine: "any",
next : ["const", "let", "var"],
prev : ["const", "let", "var"],
files: ["app/**/*.js"],
// Extend or merge with the app-specific configuration
...require("./.eslint/app/.eslintrc.js"),
},
{
blankLine: "always",
next : "*",
prev : ["case", "default"],
}
],
"quotes" : ["error", "double"],
"react/jsx-first-prop-new-line" : "error",
"react/jsx-max-props-per-line" : ["error", { "maximum": { "multi": 1, "single": 3 } }],
"react/jsx-newline" : "error",
"react/jsx-props-no-multi-spaces" : "error",
"react/prop-types" : "off",
"semi" : ["error", "always"],
"sort-keys-fix/sort-keys-fix" : "error",
"space-infix-ops" : ["error", { "int32Hint": false }],
"unused-imports/no-unused-imports": "error",
},
"settings": { "react": { "version": "detect" } },
};
]
};

44 changes: 44 additions & 0 deletions .github/workflows/auto-create-and-merge-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Auto Create and Merge PR

on:
workflow_dispatch:
branches:
- development
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
create_and_merge_pr:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: development

- name: Check for changes
id: check_changes
run: |
git fetch origin main:main
changes=$(git diff --name-only main..development)
if [ -z "$changes" ]; then
echo "No changes detected. Exiting."
exit 0
fi
- name: Create PR
run: |
pr_url=$(gh pr create --base main --head development --title "Automated PR - Merge development branch into main Branch" --body "Automated PR created by GitHub Actions." | awk '/created/ {print $5}')
echo "PR URL: $pr_url"
- name: Merge PR
run: |
pr_number=$(echo $pr_url | cut -d '/' -f 7)
gh pr merge $pr_number --rebase --admin
env:
GH_TOKEN: ${{ secrets.DEVOPS }}
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "$branch" = "main" ] || [ "$branch" = "development" ]; then
exit 1
fi

if ! [[ $branch =~ $valid_branch_n$branames_regex ]]; then
if ! [[ $branch =~ $valid_branch_names_regex ]]; then
echo "Invalid branch name: $branch; commit rejected"
echo "Please rename your branch to conform to $valid_branch_names_regex pattern."
exit 1
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"files.eol": "\n",
"[javascript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
Expand All @@ -7,7 +8,7 @@
"editor.guides.indentation": true,
"editor.renderWhitespace": "boundary",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript"
Expand Down
Loading

0 comments on commit b7403b0

Please sign in to comment.