Skip to content

Add a recreate credential option #31

Description

@en-medina

Hi, community 👋🏽

(I'm not sure if this is the correct way to ask about this)

While using this action, I encountered an issue inside a long-living self-hosted runner. I was generating a temporary GitHub app token with the actions/create-github-app-token@v1 action and then using this action to configure my git creds so I could perform some git clone commands on different repositories.

So the issue is that the first time I ran a job similar to the one found below, it worked without issue, but when I retried to run the job a second time it failed with an authentication error. While troubleshooting the runner I noticed that the action keeps the previously saved token on the /git/credentials file (that on this second run, this token was expired by the create-github-app-token post-action step). I solved the issue by removing this file at the beginning of the job, but I wanted to know if we could add an option to this action that removes this file for us (so other folks can avoid this issue).

name: My pipeline
on:
  push:
   branch:
   - main

jobs:
  my-job:
    runs-on: self-hosted
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - uses: actions/create-github-app-token@v1
        id: app-token
        with:
          app-id: ${{ secret.PIPELINE_GH_ID }}
          private-key: ${{ secret.PIPELINE_GH_PRIV }}
          owner: "myorg"

      - name: Configure git credentials
        uses: de-vri-es/setup-git-credentials@v2
        with:
          credentials: https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/

      - name: Fetch myorg repos
        run: |
          git clone https://github.com/myorg/repoA.git
          git clone https://github.com/myorg/repoB.git
          git clone https://github.com/myorg/repoC.git

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions