Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the readme.md file to make it more user friendly #356

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
91fcd5d
core: Replaced GITHUB_TOKEN with secret PAT_TOKEN in the pr title che…
krishnaacharyaa May 21, 2024
3ece3ab
chore: Updated pr-title-checker.yaml
krishnaacharyaa May 21, 2024
ed96a67
chore: Revert pack the PAT_TOKEN with GITHUB_TOKEN
krishnaacharyaa May 21, 2024
e341e91
chore: updated the events of pr-title-checker github action
krishnaacharyaa May 22, 2024
fa3663f
chore: updated pr-title-checker.yaml to not to auto close the PR
krishnaacharyaa May 22, 2024
751f57e
fix: updated pr-title-checker.yaml
krishnaacharyaa May 22, 2024
641f381
chore: Added more crisp to the pr-title-checker.yaml
krishnaacharyaa May 22, 2024
7c5555b
chore: created validate-pr-template.yml
krishnaacharyaa May 23, 2024
6c49a6e
chore: updated validate-pr-template.yml to use pull_request_target
krishnaacharyaa May 23, 2024
a22cfa8
chore: updated validate-pr-template.yml
krishnaacharyaa May 23, 2024
a946e23
chore: Updated validate-pr-template.yml
krishnaacharyaa May 23, 2024
0cdc810
chore: updated validate-pr-template.yml
krishnaacharyaa May 23, 2024
dcd2ab2
chore: Update validate-pr-template.yml
krishnaacharyaa May 23, 2024
4860946
feat-#177: Added the eslint in the husky
Ameerjafar May 22, 2024
fd8e7fc
feat-#177: convert the airbnb lint to eslint:recommended and prettier…
Ameerjafar May 22, 2024
e1f8f8c
chore: Added the suggestions
Ameerjafar May 23, 2024
990f550
chore: revert to prettier one
Ameerjafar May 23, 2024
fcd701e
chore: added the prettier recommended
Ameerjafar May 23, 2024
999b2af
chore: updated validate-pr-template.yml
krishnaacharyaa May 23, 2024
ddddc49
chore: updated validate-pr-template.yml
krishnaacharyaa May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/workflows/pr-title-checker.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: 'PR Title Checker'
on:
pull_request:
pull_request_target:
types:
- opened
- synchronize
- reopened
- edited
- closed

permissions:
contents: write
Expand All @@ -28,26 +25,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/pr-title-checker-config.json
- name: pt title satisfied

- name: PR title satisfied
if: success()
run: |
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body "Thank you ${{github.actor}}! Your PR title meets our guidelines."
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body "Hey @${{ github.actor }}! Thanks for sticking to the guidelines! High five! 🙌🏻"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Close PR if title is invalid
if: failure()
run: |
gh pr close ${{ github.event.pull_request.number }} -R ${{ github.repository }}
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body $'Hello ${{github.actor}} Thank you for your PR. Unfortunately, it doesn\'t meet our quality checks.\n\nPlease ensure you follow our contribution guidelines. The PR title should match the required format.\n\nFor example, it should be like: `fix-#124: Added responsiveness to the Home page screen.`\n\nIf you have any query kindly check our [contributor guidelines](https://github.com/krishnaacharyaa/wanderlust/blob/main/.github/CONTRIBUTING.md).'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Reopen PR if title is corrected
if: github.event.action == 'edited' && success()
run: |
if [ "${{ github.event.pull_request.state }}" == "closed" ]; then
gh pr reopen ${{ github.event.pull_request.number }} -R ${{ github.repository }}
fi
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body $'Umm... did someone forget to read the style guide? Fix that PR title and let\'s try again! @${{ github.actor }}\nDon\'t worry, it happens to the best of us! Check out our [contributor guidelines](https://github.com/krishnaacharyaa/wanderlust/blob/main/.github/CONTRIBUTING.md) for more details.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/validate-pr-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Validate PR Template

on:
pull_request_target:
types: [opened, edited]

jobs:
validate-pr:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Validate PR description
id: validate
run: |
echo "Validating PR template..."

REQUIRED_SECTIONS=("## Summary" "## Description" "## Images" "## Issue(s) Addressed" "## Prerequisites")
INVALID_STRINGS=(
"_Briefly describe the purpose of this PR._"
"_Explain in detail what this PR is all about. This should include the problem you're solving, the approach taken, and any technical details that reviewers need to know._"
"_Include any relevant images or diagrams that can help reviewers visualize the changes, if applicable_"
"_Enter the issue number of the bug(s) that this PR fixes_"
"Template should be strictly **Closes <issue_number>**"
"Example: Closes #1"
)

PR_BODY=$(jq -r .pull_request.body < $GITHUB_EVENT_PATH)
echo "$PR_BODY"
MISSING_SECTIONS=()
for section in "${REQUIRED_SECTIONS[@]}"; do
if ! echo "$PR_BODY" | grep -q "$section"; then
MISSING_SECTIONS+=("$section")
fi
done

FOUND_INVALID_STRINGS=()
for invalid in "${INVALID_STRINGS[@]}"; do
if echo "$PR_BODY" | grep -q "$invalid"; then
FOUND_INVALID_STRINGS+=("$invalid")
fi
done

if [ ${#MISSING_SECTIONS[@]} -ne 0 ] || [ ${#FOUND_INVALID_STRINGS[@]} -ne 0 ]; then
echo "PR description is missing required sections or contains invalid strings."
echo "## Missing Sections:" >> $GITHUB_STEP_SUMMARY
printf '%s\n' "${MISSING_SECTIONS[@]}" >> $GITHUB_STEP_SUMMARY
echo "## Invalid Strings Found:" >> $GITHUB_STEP_SUMMARY
printf '%s\n' "${FOUND_INVALID_STRINGS[@]}" >> $GITHUB_STEP_SUMMARY
echo "{result}={failure}" >> $GITHUB_OUTPUT
else
echo "PR description meets the template requirements."
echo "{result}={success}" >> $GITHUB_OUTPUT
fi

- name: Set PR label based on validation
if: ${{ steps.validate.outputs.result == 'failure' }}
run: |
gh pr edit ${{ github.event.pull_request.number }} --add-label "PR description needs formatting"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Remove PR label if validation passed
if: ${{ steps.validate.outputs.result == 'success' }}
run: |
gh pr edit ${{ github.event.pull_request.number }} --remove-label "PR description needs formatting"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion backend/.eslintignore

This file was deleted.

9 changes: 6 additions & 3 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"extends": ["eslint:recommended", "prettier"],
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"env": {
"jest": true,
"es2021": true,
"node": true
},
"plugins": ["babel", "jest"],
"ignorePatterns": ["note_modules/"],

"plugins": ["babel", "jest", "prettier"],
"rules": {
"no-console": "off"
"no-console": "off",
"import/extensions": "off"
}
}
4 changes: 4 additions & 0 deletions backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import globals from 'globals';
import pluginJs from '@eslint/js';

export default [{ languageOptions: { globals: globals.browser } }, pluginJs.configs.recommended];
11 changes: 8 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"lint-staged": {
"**/*.{js,ts,jsx,tsx}": [
"npx prettier --write"
"npx prettier --write",
"eslint --fix"
]
},
"scripts": {
Expand All @@ -34,10 +35,14 @@
},
"devDependencies": {
"@babel/preset-env": "^7.23.2",
"@stylistic/eslint-plugin-js": "^2.1.0",
"babel-jest": "^29.7.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint": "^9.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"globals": "^15.3.0",
"jest": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
Expand Down
1 change: 0 additions & 1 deletion frontend/.eslintignore

This file was deleted.

10 changes: 6 additions & 4 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ module.exports = {
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/stylistic-type-checked',
'prettier',
'plugin:prettier/recommended'
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
ignorePatterns: ['dist', '.eslintrc.cjs', 'node_modules/'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
plugins: [
'react-refresh'
],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
},
};
10 changes: 10 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import globals from "globals";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";


export default [
{languageOptions: { globals: globals.browser }},
...tseslint.configs.recommended,
pluginReactConfig,
];
16 changes: 13 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"lint-staged": {
"src/**/*.{js,ts,tsx,jsx}": [
"npx prettier --write"
"npx prettier --write",
"eslint --fix"
]
},
"dependencies": {
Expand All @@ -40,6 +41,9 @@
"@babel/preset-env": "^7.23.6",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@eslint/compat": "^1.0.1",
"@eslint/js": "^9.3.0",
"@stylistic/eslint-plugin-js": "^2.1.0",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
Expand All @@ -53,10 +57,15 @@
"@vitejs/plugin-react-swc": "^3.4.1",
"@vitest/coverage-v8": "^1.6.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"globals": "^15.3.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^24.0.0",
Expand All @@ -70,6 +79,7 @@
"ts-jest-mock-import-meta": "^1.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.2.2",
"typescript-eslint": "^7.10.0",
"vite": "^4.5.0",
"vitest": "^1.6.0"
}
Expand Down