Skip to content

Add action to auto format pull requests and pushes #7975

Closed
@FernandoGarcia

Description

@FernandoGarcia

Related area

Software contribuition

Hardware specification

All boards

Is your feature request related to a problem?

Hi!

I'm have noticed some maintainers and reviewers complaining about code formatting in PR here.

I would like to request to someone with more skills than me to create a script to apply formatting to all contributions for this repository.

I know that Espressif team is using Artistic style as formatter.

I was doing some tests with this action but later I have noticed that it only does a dry run for check for non compliant code.

Anyway I think the script used for this action can be useful as base to create the action for this repository.

I know there's security problems while triggering an action from public fork but I'm sure that this problem can be solved.

Alternatively I would like to suggest the use of lint with clang formatter as shown on example below.

On example below the commit with formatting changes is always signed by someone with write permission in this repository.

Best regards.

Describe the solution you'd like

Here an basic example:

name: Run clang-format Linter

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3.4.0
    - uses: DoozyX/clang-format-lint-action@v0.15
      with:
        source: '.'
        extensions: 'h,cpp,c,ino'
        clangFormatVersion: 14
        inplace: True
    - uses: EndBug/add-and-commit@v4
      with:
        author_name: someManteiner
        author_email: somemanteiner@example.com
        message: 'Committing clang-format changes'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions