-
Notifications
You must be signed in to change notification settings - Fork 3
[DOCS, FIX] edit pre-commit hooks, update FastAPI-fastkit guides #39
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a3da3ac
[CICD, DOCS] remove coverage-test, template inspection hook at pre-co…
bnbong ffea4bb
[FIX] remove hard-coded python version
bnbong 842227b
Update env.example
bnbong 9180200
[FIX] fixing template-pr-inspection workflow, update dev guides
bnbong df75477
Merge branch 'dev' of github.com:bnbong/FastAPI-fastkit into dev
bnbong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Template PR Inspection | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'src/fastapi_fastkit/fastapi_project_template/**' | ||
| types: | ||
| - opened | ||
| - synchronize | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| inspect-changed-templates: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch all history for git diff | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Setup PDM | ||
| uses: pdm-project/setup-pdm@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: pdm install -G dev | ||
|
|
||
| - name: Setup UV | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Verify Docker and Compose | ||
| run: | | ||
| docker --version | ||
| docker compose version | ||
|
|
||
| - name: Inspect changed templates | ||
| run: pdm run python scripts/inspect-changed-templates.py | ||
|
|
||
| - name: Create or Update PR Comment | ||
| if: always() | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const marker = '<!-- template-inspection-bot -->'; | ||
| const success = '${{ job.status }}' === 'success'; | ||
|
|
||
| const successBody = `${marker} | ||
| ✅ **Template Inspection Passed** | ||
|
|
||
| All changed templates have been validated successfully. | ||
|
|
||
| --- | ||
| *Last updated: ${new Date().toISOString()}*`; | ||
|
|
||
| const failureBody = `${marker} | ||
| ❌ **Template Inspection Failed** | ||
|
|
||
| Please check the workflow logs for details on what needs to be fixed. | ||
|
|
||
| [View Logs](${context.payload.repository.html_url}/actions/runs/${context.runId}) | ||
|
|
||
| --- | ||
| *Last updated: ${new Date().toISOString()}*`; | ||
|
|
||
| const body = success ? successBody : failureBody; | ||
|
|
||
| // Find existing bot comment | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number | ||
| }); | ||
|
|
||
| const botComment = comments.find(comment => | ||
| comment.body.includes(marker) | ||
| ); | ||
|
|
||
| if (botComment) { | ||
| // Update existing comment | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: botComment.id, | ||
| body: body | ||
| }); | ||
| console.log('Updated existing comment'); | ||
| } else { | ||
| // Create new comment | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: body | ||
| }); | ||
| console.log('Created new comment'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.