mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-21 04:57:58 -05:00
Compare commits
2 Commits
testing-cl
...
pwuts-code
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b016cc0c2 | ||
|
|
013cc4e3a1 |
89
.github/workflows/repo-format-on-command.yml
vendored
Normal file
89
.github/workflows/repo-format-on-command.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: Repo - Format PR on command
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-formatters:
|
||||||
|
# Run if the PR author or a maintainer comments '!format'
|
||||||
|
if: >-
|
||||||
|
github.event.issue.pull_request &&
|
||||||
|
github.event.comment.body == '!format' &&
|
||||||
|
(
|
||||||
|
github.event.comment.user.login == github.event.issue.user.login ||
|
||||||
|
github.event.comment.author_association == 'OWNER' ||
|
||||||
|
github.event.comment.author_association == 'MEMBER' ||
|
||||||
|
github.event.comment.author_association == 'COLLABORATOR'
|
||||||
|
)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: read
|
||||||
|
steps:
|
||||||
|
- name: Get PR details
|
||||||
|
id: pr
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { data: pullRequest } = await github.rest.pulls.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.issue.number,
|
||||||
|
});
|
||||||
|
|
||||||
|
core.setOutput('head_repo', pullRequest.head.repo.full_name);
|
||||||
|
core.setOutput('head_ref', pullRequest.head.ref);
|
||||||
|
core.setOutput('head_sha', pullRequest.head.sha);
|
||||||
|
|
||||||
|
- name: Checkout PR source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ steps.pr.outputs.head_repo }}
|
||||||
|
ref: ${{ steps.pr.outputs.head_ref }}
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '21'
|
||||||
|
|
||||||
|
- name: Install frontend dependencies
|
||||||
|
working-directory: autogpt_platform/frontend
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run frontend formatter
|
||||||
|
working-directory: autogpt_platform/frontend
|
||||||
|
run: yarn format
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
|
||||||
|
- name: Install Poetry
|
||||||
|
run: |
|
||||||
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Install backend dependencies
|
||||||
|
working-directory: autogpt_platform/backend
|
||||||
|
run: poetry install
|
||||||
|
|
||||||
|
- name: Run backend formatter
|
||||||
|
working-directory: autogpt_platform/backend
|
||||||
|
run: poetry run format
|
||||||
|
# ignore exit status, because format.py also runs pyight
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git config --local user.email "action@github.com"
|
||||||
|
git config --local user.name "GitHub Action"
|
||||||
|
|
||||||
|
if [[ -n $(git status --porcelain) ]]; then
|
||||||
|
git add .
|
||||||
|
git commit -m "`!format`"
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "No formatting changes needed"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user