Skip to content

Commit

Permalink
feat: Complete missing functionalities in workflows (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetozsoy-synnada authored Nov 14, 2024
1 parent d237c57 commit 725b745
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ on:
jobs:
review_pr_title:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Check PR title format
id: check_title
run: |
TITLE="${{ github.event.pull_request.title }}"
if [[ ! "$TITLE" =~ ^(feat|fix|docs|chore|perf|test|refactor): ]]; then
echo "::error::PR title does not follow the convention 'type: description'. Please review the title."
gh pr review ${{ github.event.pull_request.number }} -r -b "This PR does not satisfies PR title format. Title format should be same as one of the conventional commits"
exit 1
else
echo "PR title meets the required format."
fi
fi
17 changes: 16 additions & 1 deletion .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,19 @@ jobs:
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}

on_failure:
needs: build
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
if: ${{ failure() }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: review_pr
id: review-pr
run: |
gh pr review ${{ github.event.pull_request.number }} -r -b "Tests are failed. Please review the PR."
exit 1
31 changes: 31 additions & 0 deletions .github/workflows/pr-label-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This wrokflow is triggered when a PR is labeled.
# It assigns reviewers based on the label applied to the PR.

name: PR Label Assigner

on:
pull_request_target:
types:
- labeled

jobs:
pr-labeler:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:

- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install PyYAML
run: pip install pyyaml

- name: Assign Reviewers # Assign responsible people based on labels
run: |
python .github/scripts/assign_reviewers.py "${{ github.event.pull_request.number }}" "${{ github.event.label.name }}"

0 comments on commit 725b745

Please sign in to comment.