-
Notifications
You must be signed in to change notification settings - Fork 14
Description
While #39 implemented support for repository_dispatch events, I don't see yet how to use it when someone makes a PR from his fork. I understand the concept of using /ok-to-test and dispatching via repository_dispatch.
However, when I print the variables in the okteto/deploy-preview job:
GITHUB_EVENT_NAME=repository_dispatch
GITHUB_REF_NAME=master
GITHUB_REF=refs/heads/master
Which contains master instead of the PR branch! And okteto/deploy-preview is figuring out the branch var to pass to the okteto deployer: https://github.com/okteto/deploy-preview/blob/main/entrypoint.sh#L34-L38 so it ends up passing the master branch to the okteto deployer.
So in the end this happens:
- Someone forks your repository and creates a PR
- You type
/ok-to-deploy sha=XXXon the PR - An ok-to-deploy action is triggered which triggers an okteto-preview-deploy action (via
repository_dispatch) - The bash script in
okteto/deploy-previewincorrectly determines that master branch should be deployed based onGITHUB_REFbased on this line - A preview deploy is made using code from the latest master branch, not from the PR code changes
Any good suggestion to tackle this? I can make a PR, however I suppose we need to pass our custom own env var with the branch BRANCH since we don't have the PR number in the default env vars (it's dispatched)?
- name: Deploy preview environment
uses: okteto/deploy-preview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
with:
name: ${{ env.DEPLOY_NAME }}Did you also observe this @ikuradon ?