Can't clone gitlap in github CI?

i want to clone my gitlap repository in my GitHub ci, it is working fine in my personal repository but clone is not working fine in my organization repository.

Please refer below images:

Organization repository - clone not working

reference link : https://github.com/syncfusion/blazor-docs/runs/952679248

personal repo - clone working

reference link : https://github.com/kumaresan-subramani/ej2-blaz-doc/runs/952487607

Can you please guide me on this?

I have also configured my user name here [ https://github.com/syncfusion/blazor-docs/blob/e3a2e7d5b1185eceb011eefae5eda644f85d4156/gulpfile.js#L21]

Hi @kumaresan-subramani,

Your failed workflow is due to pull request from forked repository, it’s a limitation that cannot get secrets values in the workflow.

As doc mentioned below:
With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.

Thanks.

1 Like

HI @weide-zhou,

Below is not a forked repository:

I am following same steps which i have used my personal repository.

Hi @kumaresan-subramani,

Thanks for your reply!

I checked the failed workflow, it should be related to pull request ‘Testing #4’, please correct me if i checked the wrong pull request.

Thanks

HI @weide-zhou,

Thanks for your reply.

I think you misunderstood my issue.

IN here, there are two CI workflow takes place. one is before pull request gets merged, next one is after pull request gets merged. once pull request gets merged, ci runs for syncfusion repo and it uses secret keys from syncfusion repository.

Hi @kumaresan-subramani,

Thanks for your reply!

After pull request merged, the workflow is still triggered by pull_request event, hence secrets are not shared due to the limitation.

You can export GITHUB context in the workflow file, check the detail event for confirmation.

      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"

I don’t find any other workflow ( eg: with ‘push’ event ) in base repo ‘syncfusion/blazor-docs’. Your workflow shows below:

Thanks

HI @weide-zhou,

Thanks for your reply,

Is there any other alternate available to achieve my requirement, i mean any other alternate ways?

FYI - i have created new repo and tested same but there it is working fine

Hi @kumaresan-subramani,

Your new repo used ‘push’ event not ‘pull_request’ event, it doens’t have the limitation.
image

If you create pull request from forked repository, there’s no alternative way to share the secrets.

You have to store the secrets on base repository, create a new workflow file with event(eg: push), trigger the push event on base repository to clone the gitlab repo.

Please refer to the ‘pull_request’ events doc for the usage detail:
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request

Thanks

HI @weide-zhou,

You have to store the secrets on base repository, create a new workflow file with event(eg: push), trigger the push event on base repository to clone the gitlab repo.

In above, do you want me to create new yml file and trigger tht workflow after pull_request workflow ends. if yes, please provide some guidelines

I have added push event too. like below:

Hi @kumaresan-subramani,

As i said, it’s not supported to shared secrets from forked repository.

You need to remove the clone steps in the current workflow yaml since it doesn’t work.
You can create a new yaml file with ‘push’ event on base repository, after PR merged, it will trigger push event to clone the repo(of course, the secrets are stored on base repo).

Please export the GITHUB CONTEXT for your workflow, check the details could help you understand the event mechanism, how it be triggered, what’s the github.sha…etc.

Please DO read the docs below, and do some testing for understanding:
https://docs.github.com/en/actions/reference/events-that-trigger-workflows
https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#using-encrypted-secrets-in-a-workflow

Thanks

HI @weide-zhou,

Thank you so much issue resolved

1 Like