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

worflow addition #122

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions .github/label.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
53 changes: 53 additions & 0 deletions .github/workflows/auto-label-prs.yml
Original file line number Diff line number Diff line change
@@ -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 });

21 changes: 21 additions & 0 deletions .github/workflows/issue-labeler.yml
Original file line number Diff line number Diff line change
@@ -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"]
})
33 changes: 33 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -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')
28 changes: 28 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -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
Loading