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

Merge with Develop 2024-1-14 #2432

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ REACT_APP_USE_RECAPTCHA=
REACT_APP_RECAPTCHA_SITE_KEY=

# has to be inserted in the env file to use plugins and other websocket based features.
REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql
REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql/

# If you want to logs Compiletime and Runtime error , warning and info write YES or if u want to
# keep the console clean leave it blank
ALLOW_LOGS=
ALLOW_LOGS=
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-assertions": "error",
Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ updates:
directory: "/"
# Schedule automated updates to run weekly
schedule:
interval: "weekly"
interval: "monthly"
# Labels to apply to Dependabot PRs
labels:
- "dependencies"
# Specify the target branch for PRs
target-branch: "develop"
# Customize commit message prefix
commit-message:
prefix: "chore(deps):"
prefix: "chore(deps):"
8 changes: 8 additions & 0 deletions .github/workflows/auto-label.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"labelsSynonyms": {
"dependencies": ["dependabot", "dependency", "dependencies"],
"security": ["security"],
"ui/ux": ["layout", "screen", "design", "figma"]
},
"defaultLabels": ["unapproved"],
}
3 changes: 2 additions & 1 deletion .github/workflows/codeql-codescan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ on:
- '**'
jobs:
CodeQL:
name: Analyse code with codeQL on push
if: ${{ github.actor != 'dependabot[bot]' }}
name: Analyse Code With CodeQL
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/eslint_disable_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ def has_eslint_disable(file_path):
Returns:
bool: True if eslint-disable statement is found, False otherwise.
"""
with open(file_path, 'r') as file:
content = file.read()
return re.search(r'//\s*eslint-disable', content)
eslint_disable_pattern = re.compile(r'//\s*eslint-disable(?:-next-line|-line)?', re.IGNORECASE)

try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
return bool(eslint_disable_pattern.search(content))
except Exception as e:
print(f"Error reading file {file_path}: {e}")
return False

def check_eslint(directory):
"""
Expand Down Expand Up @@ -72,7 +78,6 @@ def arg_parser_resolver():

Returns:
result: Parsed argument object

"""
parser = argparse.ArgumentParser()
parser.add_argument(
Expand All @@ -98,7 +103,6 @@ def main():
Raises:
SystemExit: If an error occurs during execution.
"""

args = arg_parser_resolver()

if not os.path.exists(args.directory):
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,43 @@ jobs:
name: Adding Issue Label
runs-on: ubuntu-latest
steps:
- uses: Renato66/[email protected]
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/auto-label.json5
sparse-checkout-cone-mode: false
- uses: Renato66/auto-label@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ignore-comments: true
default-labels: '["unapproved"]'

- uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const apiParams = {
owner,
repo,
issue_number
};
const labels = await github.rest.issues.listLabelsOnIssue(apiParams);
if(labels.data.reduce((a, c)=>a||["dependencies"].includes(c.name), false))
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["good first issue", "security"]
});
else if(labels.data.reduce((a, c)=>a||["security", "ui/ux"].includes(c.name), false))
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["good first issue"]
});


Issue-Greeting:
name: Greeting Message to User
runs-on: ubuntu-latest
Expand Down
35 changes: 25 additions & 10 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ jobs:
- name: Count number of lines
run: |
chmod +x ./.github/workflows/countline.py
./.github/workflows/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx
./.github/workflows/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx src/components/TagActions/TagActionsMocks.ts src/utils/interfaces.ts src/screens/MemberDetail/MemberDetail.tsx

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v41

uses: tj-actions/changed-files@v40
- name: Check formatting
if: steps.changed-files.outputs.only_changed != 'true'
run: npm run format:check

- name: Run formatting if check fails
if: failure()
run: npm run format

- name: Check for type errors
if: steps.changed-files.outputs.only_changed != 'true'
Expand All @@ -56,7 +59,7 @@ jobs:
if: steps.changed-files.outputs.only_changed != 'true'
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES}
run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py

- name: Check for TSDoc comments
run: npm run check-tsdoc # Run the TSDoc check script
Expand All @@ -79,23 +82,25 @@ jobs:
echo "Error: Source and Target Branches are the same. Please ensure they are different."
exit 1

Check-Unauthorized-Changes:
name: Checks if no unauthorized files are changed
Check-Sensitive-Files:
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
name: Checks if sensitive files have been changed without authorization
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Changed Unauthorized files
id: changed-unauth-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40
with:
files: |
.github/**
env.example
.node-version
.husky/**
scripts/**
schema.graphql
package.json
tsconfig.json
.gitignore
Expand All @@ -110,6 +115,14 @@ jobs:
LICENSE
setup.ts
.coderabbit.yaml
CODE_OF_CONDUCT.md
CODE_STYLE.md
CONTRIBUTING.md
DOCUMENTATION.md
INSTALLATION.md
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md

- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
Expand All @@ -122,6 +135,7 @@ jobs:
exit 1

Count-Changed-Files:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Checks if number of files changed is acceptable
runs-on: ubuntu-latest
steps:
Expand All @@ -130,7 +144,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40

- name: Echo number of changed files
env:
Expand Down Expand Up @@ -183,7 +197,7 @@ jobs:

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40

- name: Run tests
if: steps.changed-files.outputs.only_changed != 'true'
Expand Down Expand Up @@ -212,6 +226,7 @@ jobs:
min_coverage: 95.0

Graphql-Inspector:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Runs Introspection on the GitHub talawa-api repo on the schema.graphql file
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -239,6 +254,7 @@ jobs:
run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'

Check-Target-Branch:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Check Target Branch
runs-on: ubuntu-latest
steps:
Expand All @@ -247,4 +263,3 @@ jobs:
run: |
echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md"
exit 1

2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ env:

jobs:
Code-Coverage:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Test and Calculate Code Coverage
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
3) Pycodestyle
4) Flake8
"""

import os
import argparse
import re
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# npm run format:fix
npm run format:fix
# npm run lint:fix
npm run lint-staged
npm run typecheck
Expand Down
Loading
Loading