Skip to content

Commit

Permalink
Merge pull request #1 from airwoodix/typos-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
airwoodix authored Nov 29, 2024
2 parents cf6e70e + ab84b10 commit 0f91381
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on: pull_request
name: CI jobs
jobs:
main:
permissions:
pull-requests: write
runs-on: ubuntu-latest
name: My workflow
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Spell check
id: spell-check
run: |
status=0
echo "### :bulb: Spell check report" > spell_check_report.md
uv run typos --format brief >> spell_check_report.md || status=$?
exit 0
- name: Save spell check report artifact
uses: actions/upload-artifact@v4
with:
name: Spell check report
path: spell_check_report.md
37 changes: 37 additions & 0 deletions .github/workflows/pr_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR comments

on:
workflow_run:
workflows:
- CI jobs
types:
- completed

jobs:
spell-check-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download spell check report
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
name: Spell check report
run-id: ${{ github.event.workflow_run.id }}
- name: Check if spell check failed
id: spell-check
run: |
lines=$(wc -l spell_check_report.md | cut -d ' ' -f1)
if [[ ${lines} -gt 1 ]]; then
echo "failed=true" >> "${GITHUB_OUTPUT}"
else
echo "failed=false" >> ${GITHUB_OUTPUT}"
fi
- name: Post spell check PR comment
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: spell-check-failed
file-path: spell_check_report.md
mode: ${{ steps.spell-check.outputs.failed == 'true' && 'upsert' || 'delete' }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# Virtual environments
.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
6 changes: 6 additions & 0 deletions hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def main():
print("recieve")


if __name__ == "__main__":
main() # recieve moer
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[project]
name = "gh-typos-comment"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"typos>=1.28.1",
]
30 changes: 30 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f91381

Please sign in to comment.