|
| 1 | +name: Hacktoberfest Auto-Label |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened] |
| 6 | + issues: |
| 7 | + types: [opened] |
| 8 | + |
| 9 | +jobs: |
| 10 | + label: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Add Hacktoberfest label to PRs |
| 14 | + if: github.event_name == 'pull_request' |
| 15 | + uses: actions/github-script@v6 |
| 16 | + with: |
| 17 | + script: | |
| 18 | + github.rest.issues.addLabels({ |
| 19 | + issue_number: context.issue.number, |
| 20 | + owner: context.repo.owner, |
| 21 | + repo: context.repo.repo, |
| 22 | + labels: ['hacktoberfest'] |
| 23 | + }) |
| 24 | +
|
| 25 | + - name: Welcome new contributors |
| 26 | + if: github.event_name == 'pull_request' |
| 27 | + uses: actions/github-script@v6 |
| 28 | + with: |
| 29 | + script: | |
| 30 | + const welcomeMessage = ` |
| 31 | + 🎃 **Welcome to Hacktoberfest 2025!** 🎃 |
| 32 | +
|
| 33 | + Thank you for your contribution to Python-Basics-to-Advanced! |
| 34 | +
|
| 35 | + Your pull request will be reviewed by our maintainers. Please make sure: |
| 36 | + - [ ] Your code follows our style guidelines |
| 37 | + - [ ] You've added appropriate comments and documentation |
| 38 | + - [ ] You've tested your changes |
| 39 | + - [ ] Your PR title is descriptive |
| 40 | +
|
| 41 | + Happy coding! 🐍✨ |
| 42 | + `; |
| 43 | +
|
| 44 | + github.rest.issues.createComment({ |
| 45 | + issue_number: context.issue.number, |
| 46 | + owner: context.repo.owner, |
| 47 | + repo: context.repo.repo, |
| 48 | + body: welcomeMessage |
| 49 | + }) |
| 50 | +
|
| 51 | + test: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + if: github.event_name == 'pull_request' |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v3 |
| 56 | + |
| 57 | + - name: Set up Python |
| 58 | + uses: actions/setup-python@v4 |
| 59 | + with: |
| 60 | + python-version: "3.x" |
| 61 | + |
| 62 | + - name: Install dependencies |
| 63 | + run: | |
| 64 | + python -m pip install --upgrade pip |
| 65 | + pip install flake8 black |
| 66 | +
|
| 67 | + - name: Lint with flake8 |
| 68 | + run: | |
| 69 | + # Stop the build if there are Python syntax errors or undefined names |
| 70 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 71 | + # Exit-zero treats all errors as warnings |
| 72 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics |
| 73 | +
|
| 74 | + - name: Check code formatting with black |
| 75 | + run: black --check --diff . |
0 commit comments