Lowercasing the name field in Okteto's GitHub actions

Hi,

I followed the Okteto movies tutorial which explains how to deploy a development environment using Okteto.

The first step of the tutorial is to fork the movies project into the user’s GitHub account and then run the pipeline in order to deploy the project to the user’s Okteto namespace.

In the GitHub Actions workflows of the movies project, the namespace “cindylopez” is hardcoded here. That means, when I fork the project to my GitHub account and deploy it, the deployment will fail, this is because the name “cindylopez” is different from the user’s github username. As explianed here it is quoted: the preview environment name must have your github ID as a suffix.

I had play around this. So instead of hardcoding my GitHub username, I utilized the github environemnt variable ${{ github.actor }} in my GitHub Actions workflow, so my GitHub username is placed dynamically. you can have a look at it here
There is only a small problem popped up here, my github username contains capital letters. This is not allowed in Okteto. so I had to use a third party github action to lowercase my username.

I would suggest:

  • As this is an Okteto condition to suffix the preview name with the user’s github username and it should lowercase, then I would suggest adding the functinality to the “deploy-preview-environment” action to lowercase the name field typed by the user. so I can use the ${{ github.actor }} placeholder without the need to care about lowercasing my username.

  • If this request is accepted, then I would suggest replacing the github usename “cindylopez” with “${{ github.actor }}”. I can commit this change to the movies project if that is okay.

1 Like

@Hosam I don’t think that github.actor will work in this case, because the token might belong to a different user than the one that triggered the action (when more than one person is committing to the same repo this is very typical).

We recommend that instead of hardcoding, you create an OKTETO_USERNAME environment variable on GitHub, and then use that in your action. We’ll update the documentation to make this clearer.