Mvn release issues when pushing to protected branch: reviewer required

Hello everyone,

I’m using Github Actions to automatically build, package and deploy to three different environments. I have a protected main branch which requires 1 reviewer on a PR to main. This works like a charm. However, when I want to automatically release my code with Maven, Maven tries to commit to main (as expected) but throws an error because main is a protected branch. My POM file contains a property called ‘project.scm.id’ with the value github, and I am creating a settings.xml file in my job containing a server with id Github with an username which has admin right. Locally, this works perfectly fine, because the admin ignores the protected branch rules, but in Github Actions, I am still facing the same issue. Does someone has experience with this?

A snippet from my workflow:

    - uses: s4u/maven-settings-action@v2.4.1
      with:
        githubServer: false
        servers: '[{ "id": "github", "username": "<username>", "password": "<password>" }]'
 
    - name: Echo
      run: |
        cat /home/runner/.m2/settings.xml

    - name: Publish JAR
      run: mvn -s /home/runner/.m2/settings.xml -B release:prepare release:perform

Error snippet:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  50.739 s
[INFO] Finished at: 2021-11-24T15:07:50Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project abcdefg: Unable to commit files
Error:  Provider message:
Error:  The git-push command failed.
Error:  Command output:
Error:  remote: error: GH006: Protected branch update failed for refs/heads/main.        
Error:  remote: error: At least 1 approving review is required by reviewers with write access.