checkout not checking out branch #1637
Replies: 1 comment
-
NOTE: We discovered this is working correctly, we discovered that adding a conditional such as: if: github.event.issue.pull_request && contains(github.event.comment.body, 'test this please') then the workflow runs against the default branch, and not the branch that kicked off the workflow. If I remove the conditional all together, then the workflow runs against the PR branch. I think per this url: https://docs.github.com/en/actions/learn-github-actions/contexts that the 'runner' is changing the $GITHUB_REF to default branch. In this example, the if statement checks the github.ref context to determine the current branch name; if the name is refs/heads/main, then the subsequent steps are executed. The if check is processed by GitHub Actions, and the job is only sent to the runner if the result is true. Once the job is sent to the runner, the step is executed and refers to the $GITHUB_REF variable from the runner. So we think the runner is changing to the default branch. We are working with the implementer of the runner to troubleshoot. |
Beta Was this translation helpful? Give feedback.
-
Is anyone else having issues with this, the README says
permissions:
id-token: write
contents: write
on:
pull_request:
types: [opened, reopened]
issue_comment:
types: [ created ]
workflow_dispatch:
jobs:
preflight-vars:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
runs-on: [ HOST ]
Beta Was this translation helpful? Give feedback.
All reactions