s4u / setup-maven-action

Complete environment configuration for Maven builds
MIT License
59 stars 24 forks source link

Can't commit when using 's4u/setup-maven-action' #68

Open abelsromero opened 9 months ago

abelsromero commented 9 months ago

Describe the bug Using the action breaks Git configuration preventing committing/pushing with the TOKEN user.

To Reproduce Trying to automate a maven deployment with maven-release-plugin, this fails with the error below.

      - uses: s4u/setup-maven-action@v1.11.0
        with:
          java-distribution: 'temurin'
          java-version: ${{ matrix.java }}
          maven-version: ${{ matrix.maven }}
          settings-servers: |
            [{
              "id": "ossrh",
              "username": "${{ secrets.OSS_SONATYPE_USERNAME }}",
              "password": "${{ secrets.OSS_SONATYPE_PASSWORD }}"
            }]
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.1:prepare (default-cli) on project asciidoctor-maven-tools: Unable to commit files
Error:  Provider message:
Error:  The git-push command failed.
Error:  Command output:
Error:  fatal: could not read Username for 'https://github.com/': No such device or address

This however works fine:

      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Setup Java
        uses: actions/setup-java@v4
        with:
          distribution: 'temurin'
          java-version: ${{ matrix.java }}
      - uses: s4u/maven-settings-action@v3.0.0
        with:
          servers: |
            [{
              "id": "ossrh",
              "username": "${{ secrets.OSS_SONATYPE_USERNAME }}",
              "password": "${{ secrets.OSS_SONATYPE_PASSWORD }}"
            }]

Expected behavior I'd expect to be able to use setup-maven-action.

Additional context Add any other context about the problem here.

slawekjaranowski commented 8 months ago

Loos similar to https://github.com/s4u/maven-settings-action/issues/293

abelsromero commented 8 months ago

I don't think it's related. The is using Git token provided by GH action. My guess is setup-maven-action is doing/or not doing something that breaks them.

slawekjaranowski commented 8 months ago

I did a test #74 - looks like works settings contains expected items

abelsromero commented 8 months ago

Sorry, I am not making myself clear. The issue is not setting the properties to push to ossh, as shown in the error above, for example when running maven-release-plugin it fails when attempting a GIT push to the repository using the provided GITHUB credential in the pipeline. Same happened if attempting to run simply touch file && git add . && git commit -m "test" && git push, however, using the other configuration, that works fine. No GIT user problems.