diff --git a/.github/workflows/blackformatter.yml b/.github/workflows/blackformatter.yml index c4d91e7..c24fb26 100644 --- a/.github/workflows/blackformatter.yml +++ b/.github/workflows/blackformatter.yml @@ -9,11 +9,13 @@ jobs: format-check: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: - name: Checkout code uses: actions/checkout@v4 - with: - persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 @@ -25,11 +27,19 @@ jobs: - name: Run Black run: black . - + + - name: Commit changes if formatting is needed + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git add . + git diff --cached --exit-code || git commit -m "Auto-format code with Black" + - name: Push changes back to the pull request branch - uses: gr2m/create-or-update-pull-request-action@v1 + uses: peter-evans/create-pull-request@v7 with: - author: "github-actions[bot] " - commit-message: "Formatted with Black per repo requirements" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + base: ${{ github.head_ref }} + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + title: Formatting Code + body: Formatting code with black diff --git a/teleband/assignments/admin.py b/teleband/assignments/admin.py index 7e93122..b5a1cc3 100644 --- a/teleband/assignments/admin.py +++ b/teleband/assignments/admin.py @@ -87,6 +87,22 @@ class AssignmentInline(admin.TabularInline): @admin.register(AssignmentGroup) class AssignmentGroupAdmin(VersionAdmin): + + + + + + + + + + + + + + + + list_display = ( "id", "type", diff --git a/teleband/submissions/admin.py b/teleband/submissions/admin.py index 228c2b9..61d415a 100644 --- a/teleband/submissions/admin.py +++ b/teleband/submissions/admin.py @@ -18,6 +18,31 @@ class SubmissionAdmin(VersionAdmin): @admin.register(SubmissionAttachment) class SubmissionAttachmentAdmin(VersionAdmin): list_display = ("id", "submission", "file") + + + + + + + + + + + + + + + + + + + + + + + + + raw_id_fields = ("submission",) # list_filter = ("submission",)