Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand how to manage github token in worflows for the triggers of the actions #38

Open
MSECode opened this issue Jan 13, 2025 · 3 comments
Assignees

Comments

@MSECode
Copy link
Member

MSECode commented Jan 13, 2025

Task description 📝

How should be the GITHUB_TOKEN managed in the workflow files. Should we save the github token for the triggers under the secrets of the repo or should we request the token saved in another repo using the Get Token action tibdex/github-app-token@v2.

Definition of Done ✅

Study that and modify the workflow files accordingly.

@pattacini
Copy link
Member

Hi @MSECode

Can you describe the GH action in question?

@MSECode
Copy link
Member Author

MSECode commented Jan 13, 2025

I was not sure if it is better to change these lines:
https://github.com/icub-tech-iit/docker-deployment-images/blob/master/.github/workflows/release.yml#L70-L72
requesting instead the token in this manner:

- name: Get Token

        id: get_workflow_token

        uses: tibdex/github-app-token@v2

        with:

          private_key: ${{ secrets.ICUB_TECH_IIT_APP_KEY }}

          app_id: ${{ secrets.ICUB_TECH_IIT_APP_ID }}

          installation_retrieval_mode: repository

          installation_retrieval_payload: icub-tech-iit/code

However, probably this problem can be considered already solved by the discussion we had here: #24
And therefore the workflow can be as it is now.

@pattacini
Copy link
Member

pattacini commented Jan 14, 2025

Hi @MSECode

It seems you're trying to dispatch an event to the same repository.
So, check out the documentation of https://github.com/peter-evans/repository-dispatch.

It suffices to do:

  - name: Repository Dispatch
    uses: peter-evans/repository-dispatch@v3
    with:
      event-type: my-event

Therefore, providing the token explicitly (which will be GITHUB_TOKEN under the hood) is unnecessary.

And therefore the workflow can be as it is now.

To sum up, yep 👍🏻
However, I suggest you clean it up according to the action documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants