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

Sweep: write me a github actions that runs pre-commit on every PR, cache the pre-commit post-installation image #2747

Open
1 task done
kevinlu1248 opened this issue Dec 11, 2023 · 1 comment
Labels
sweep Assigns Sweep to an issue or pull request.

Comments

@kevinlu1248
Copy link
Member

kevinlu1248 commented Dec 11, 2023

Checklist
  • Create .github/workflows/pre_commit.yml6f7e450 Edit

Flowchart

@kevinlu1248 kevinlu1248 added the sweep Assigns Sweep to an issue or pull request. label Dec 11, 2023
Copy link
Contributor

sweep-nightly bot commented Dec 11, 2023

Here's the PR! #2748. See Sweep's process at dashboard.

💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: d6756a5c45)

Actions (click)

  • ↻ Restart Sweep

Sandbox execution failed

The sandbox appears to be unavailable or down.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description.

install:
- pre-commit install
- pip install poetry
- poetry install
check:
- pre-commit run --files {file_path}
- 'if [[ "{file_path}" == *.py ]]; then poetry run pylint --errors-only {file_path}; else exit 0; fi'
- 'if [[ "{file_path}" == *.py ]]; then PYTHONPATH=. poetry run python {file_path}; else exit 0; fi'
```
Sandbox executes commands in a sandboxed environment to validate code changes after every edit. For example, our sandbox can run tests! For more details, see the [Sandbox](./sandbox) page.
### `gha_enabled`
```yaml
gha_enabled: True
```

```yaml
gha_enabled: True
branch: main
blocked_dirs: [".github/"]
draft: False
description: "sweepai/sweep is a python 3.10 project. The main api endpoints are in sweepai/api.py. Write code that adheres to PEP8."
docs:
- Modal: https://modal.com/docs/reference
- PyGitHub: https://pygithub.readthedocs.io/en/latest/
sandbox:
install:
- pre-commit install
- pip install poetry
- poetry install

sweep/pyproject.toml

Lines 75 to 90 in 02653c2

unidiff = "^0.7.5"
[tool.poetry.dev-dependencies]
pylint = "^2.17.4"
black = "^23.1.0"
commit5 = "^0.1.1"
jupyter = "^1.0.0"
ipykernel = "^6.23.1"
build = "^0.10.0"
flake8 = "^6.0.0"
nptyping = "^2.5.0"
pre-commit = "^3.2.0"
[[tool.poetry.source]]
name = "torch"


Step 2: ⌨️ Coding

  • Create .github/workflows/pre_commit.yml6f7e450 Edit
Create .github/workflows/pre_commit.yml with contents:
• Create a new file named pre_commit.yml in the .github/workflows directory.
• At the top of the file, define a workflow that is triggered on pull requests. Use the 'on: pull_request' syntax to specify this.
• Define a job that runs on an ubuntu-latest runner. Use the 'runs-on: ubuntu-latest' syntax to specify this.
• In the job, add a step that checks out the repository. Use the 'actions/checkout@v2' action to do this.
• Add a step that sets up Python 3.10. Use the 'actions/setup-python@v2' action and specify '3.10' as the Python version.
• Add a step that installs poetry. Use the 'install-poetry/action@v1' action to do this.
• Add a step that installs the project's dependencies using poetry. Use the 'run: poetry install' command to do this.
• Add a step that caches the pre-commit post-installation image. Use the 'actions/cache@v2' action and specify the path to the post-installation image as the path to cache.
• Add a step that runs pre-commit on the changed files. Use the 'run: pre-commit run --files {file_path}' command to do this, where {file_path} is the path to the changed files.

Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/pre-commit-github-action.


🎉 Latest improvements to Sweep:

  • We just released a dashboard to track Sweep's progress on your issue in real-time, showing every stage of the process – from search to planning and coding.
  • Sweep uses OpenAI's latest Assistant API to plan code changes and modify code! This is 3x faster and significantly more reliable as it allows Sweep to edit code and validate the changes in tight iterations, the same way as a human would.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.
Join Our Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant