From 81972d306641e657a3514ee369081ee042f0f64c Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:26:47 +0530 Subject: [PATCH 1/9] worflow additon --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/pylint.yml | 23 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pylint.yml 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..0ad87c34f --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: Pylint + +on: [push] + +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 From 4ec56204988e8d061dcd726d2b29e1aa68eff568 Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:35:52 +0530 Subject: [PATCH 2/9] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a68ed5a78..879b5e9bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.10 + python-version: 3.12 - name: Install Dependencies run: | From e223f10f937c97f7ebfed4774b22ebb2652dee0a Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:39:58 +0530 Subject: [PATCH 3/9] .github\workflows\auto-label-prs.yml --- .github/workflows/auto-label-prs.yml | 52 ++++++++++++++++++++++++++++ .github/workflows/main.yml | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/auto-label-prs.yml diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 000000000..3f26d1b58 --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,52 @@ +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/main.yml b/.github/workflows/main.yml index 879b5e9bb..a68ed5a78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.12 + python-version: 3.10 - name: Install Dependencies run: | From 32f9f40fa976ff44e440d285577d05c9eff4ca9b Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:42:05 +0530 Subject: [PATCH 4/9] o --- .github/workflows/auto-label-prs.yml | 3 ++- .github/workflows/pylint.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml index 3f26d1b58..250ec7c01 100644 --- a/.github/workflows/auto-label-prs.yml +++ b/.github/workflows/auto-label-prs.yml @@ -1,5 +1,6 @@ name: Auto Label PRs -on: + +on: pull_request: types: - opened diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 0ad87c34f..7a7f4de8c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,6 +1,6 @@ name: Pylint -on: [push] +on: [push, pull_request] jobs: build: From 3882673409805ef9e061799c4c5e14bd67cf4f36 Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:46:38 +0530 Subject: [PATCH 5/9] Create label.yml --- .github/workflows/label.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/label.yml diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 000000000..6eff56474 --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,15 @@ +name: Labeler +on: [pull_request_target] + +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 From 7ccd5c1520d9a06c80af5031445e23a7abf0f9db Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:47:23 +0530 Subject: [PATCH 6/9] Update label.yml --- .github/workflows/label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 6eff56474..ebe5df42d 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,5 +1,5 @@ name: Labeler -on: [pull_request_target] +on: [pull_request_target, pull_request] jobs: label: From f27accfd4dccbb622e9636f1205cfe0bb48fc215 Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 14:50:03 +0530 Subject: [PATCH 7/9] 3 --- .github/{workflows => }/label.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => }/label.yml (100%) diff --git a/.github/workflows/label.yml b/.github/label.yml similarity index 100% rename from .github/workflows/label.yml rename to .github/label.yml From c7292b40acf6bd064ecb0412a17b1c5735355b30 Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 15:01:41 +0530 Subject: [PATCH 8/9] Create issue-labeler.yml --- .github/workflows/issue-labeler.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/issue-labeler.yml 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"] + }) From f3eef96f8cbe651fbe7d55fabf661dbd831d8e01 Mon Sep 17 00:00:00 2001 From: rajveer43 Date: Thu, 7 Sep 2023 15:43:17 +0530 Subject: [PATCH 9/9] Create stale.yml --- .github/workflows/stale.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/stale.yml 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