0

Here is my current workflow step names and its timings that it takes. I am using actions/create-github-app-token@v1 as recommended.

  1. Checkout code: 1 second
  2. Set up Node.js: 1 second
  3. Calculate maxPatchPublishDate: 2 seconds
  4. Debug maxPatchPublishDate: 1 second
  5. Install dependencies: 2 seconds
  6. Generate the token for checking out the called workflow repo: 1 second
  7. Checkout called workflow repository: 1 second
  8. Install AZ modules: 3 minutes
  9. Azure login: 20 seconds
  10. powershell execution: 1 hour 15 minutes
  11. Check if CSV files exists: 1 second
  12. Install GitHub CLI: 1 second
  13. Authenticate with GitHub CLI: 1 second
  14. Re-generate the token: 1 second
  15. Create or update file and push changes and create pull request and merge pull request and delete branch: Failing

Here is my code for step #14 and #15

  - name: Re-generate the Token
    uses: actions/create-github-app-token@v1
    id: app-token
    with:
      app-id: ${{ secrets.APP_ID }}
      private-key: ${{ secrets.PRIVATE_KEY }}
      owner: ${{ github.repository_owner }}
      repositories: |
        automation-framework
    
  - name: Create or Update File AND Push Changes AND Create Pull Request AND Merge Pull Request AND Delete Branch
    run: |
      timestamp=$(date +%d-%m-%Y-%H-%M-%S)
      folder_path="Patching_reports/test/$timestamp"
      mkdir -p $folder_path
      mv /tmp/*.csv $folder_path/
    
      git config --global user.name "automation-app[bot]"
      git config --global user.email "automation-app[bot]@users.noreply.github.com"
    
      git add $folder_path
      git commit -m "suhas-Add patching reports generated on $timestamp"
      GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/xxxxxxx/automation-framework.git || echo "Nothing to push

But, The last step is failing with the below error:

remote: Invalid username or password.
fatal: Authentication failed for '[https://github.com/xxxxxxx/automation-framework.git/'
Nothing to push
##[debug]Finishing: Create or Update File AND Push Changes AND Create Pull Request AND Merge Pull Request AND Delete Branch

Has anyone come across such issues?

The above code is of the parent /called workflow. This is being invoked from child repo.

6
  • I'm not sure I understand the parent/child terminology, since it sounds like you're saying the child is calling the parent? In any case, does the repository that hosts the caller have access to the secrets, and do you make them accessible to the reusable workflow either explicitly or using secrets: inherit? Commented Apr 2 at 17:14
  • hi @BenjaminW. yes, I am passing all the required secrets from the calling workflow to the called workflow. As mentioned, it works fine when the workflow takes less than an hour. If the workflow takes more than an hour, it fails with the error that is mentioned above. Commented Apr 2 at 18:28
  • Strange, the docs say that the token should be valid up to 24 hours. Commented Apr 2 at 20:25
  • Oh wait, you're creating an app token Commented Apr 2 at 20:25
  • Why don't you use a fine-grained API token? Commented Apr 2 at 20:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.