diff --git a/.github/label.yml b/.github/label.yml new file mode 100644 index 000000000..ebe5df42d --- /dev/null +++ b/.github/label.yml @@ -0,0 +1,15 @@ +name: Labeler +on: [pull_request_target, pull_request] + +jobs: + label: + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 000000000..250ec7c01 --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,53 @@ +name: Auto Label PRs + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + label-pr: + runs-on: ubuntu-latest + + steps: + - name: Check for Bug, Feature, or Enhancement + id: pr-label + run: | + pr_labels="" + changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) + + # Check for specific keywords in changed files + for file in $changed_files; do + if grep -qE 'bugfix|bug\s|fix\s|fixed\s|fixing\s|issue\s|bug\s|error\s|problem\s' $file; then + pr_labels="${pr_labels}bug," + fi + + if grep -qE 'feature|new\sfeature|feature\saddition' $file; then + pr_labels="${pr_labels}feature," + fi + + if grep -qE 'enhancement|improvement|enhance\s|improve\s' $file; then + pr_labels="${pr_labels}enhancement," + fi + done + + # Remove trailing comma and set labels + pr_labels="${pr_labels%,}" + echo "::set-output name=labels::${pr_labels}" + + - name: Set PR Labels + if: steps.pr-label.outputs.labels != '' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const labels = "${{ steps.pr-label.outputs.labels }}".split(','); + const issue = context.issue; + + // Remove existing labels to avoid duplicates + await github.issues.removeLabels({ ...issue }); + + // Set the new labels + await github.issues.addLabels({ ...issue, labels }); + diff --git a/.github/workflows/issue-labeler.yml b/.github/workflows/issue-labeler.yml new file mode 100644 index 000000000..9bcae23c3 --- /dev/null +++ b/.github/workflows/issue-labeler.yml @@ -0,0 +1,21 @@ +name: Label issues +on: + issues: + types: + - reopened + - opened +jobs: + label_issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ["help wanted", "good first issue", "enhancement"] + }) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..a68ed5a78 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,33 @@ +name: Python Formatting Check + +on: [push, pull_request] + +jobs: + format-check: + name: Check Python Formatting + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.10 + + - name: Install Dependencies + run: | + pip install flake8 black ruff + + - name: Check Formatting with Flake8 + run: flake8 + continue-on-error: true + + - name: Check Formatting with Black + run: black --check . + continue-on-error: true + + - name: Check Formatting with Ruff + run: ruff check + continue-on-error: true \ No newline at end of file diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 000000000..7a7f4de8c --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: Pylint + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..a274e84ef --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,28 @@ +name: Mark stale pull requests + +on: + schedule: + - cron: "0 0 * * *" + +permissions: + pull-requests: write + +jobs: + stale: + if: github.repository_owner == 'shishirPatil' + + runs-on: ubuntu-latest + timeout-minutes: 2 + + steps: + - name: "Check PRs" + uses: actions/stale@v8 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-pr-message: 'This PR is stale because it has been open for 7 days with no activity.' + stale-pr-label: 'stale' + days-before-issue-stale: -1 + days-before-pr-stale: 30 + days-before-close: -1 + ascending: true + operations-per-run: 120 \ No newline at end of file