You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: preview/README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,12 @@ You can read more about this in the [GitHub Actions documentation][link-actions]
123
123
### Create previews on pull requests
124
124
125
125
This workflow creates a new EAS Update every time a pull request is created or updated.
126
-
Since we're using the `--auto` flag, the EAS branch will be named after the GitHub branch, and the message for the update will match the commit's message.
126
+
We are using the `--auto`, together with the `--branch`, flag in this example.
127
+
-`--auto` will automatically create an update using the current git commit message and git branch.
128
+
-`--branch` will overwrite this value infere from git with our own value.
129
+
130
+
> **Warning**
131
+
> GitHub Actions might use a temporary merge branch for PRs. To avoid using this merge branch for our update, we overwrite the branch name from `--auto` with our own `--branch` value.
127
132
128
133
```yml
129
134
on:
@@ -156,7 +161,9 @@ jobs:
156
161
- name: 🚀 Create preview
157
162
uses: expo/expo-github-action/preview@v8
158
163
with:
159
-
command: eas update --auto
164
+
# `github.event.pull_request.head.ref` is only available on `pull_request` triggers.
165
+
# Use your own, or keep the automatically infered branch name from `--auto`, when using different triggers.
166
+
command: eas update --auto --branch ${{ github.event.pull_request.head.ref }}
160
167
```
161
168
162
169
### Sending preview information elsewhere
@@ -197,6 +204,8 @@ jobs:
197
204
uses: expo/expo-github-action/preview@v8
198
205
id: preview
199
206
with:
207
+
# In this example, we use the `push` trigger which will always use the branch name that was pushed to.
208
+
# By using `--auto` we both use the git commit message and branch name for the update.
200
209
command: eas update --auto
201
210
comment: false
202
211
@@ -216,6 +225,13 @@ jobs:
216
225
When automating these preview comments, you have to be careful not to spam a pull request on every successful run.
217
226
Every comment contains a generated **message-id** to identify previously made comments and update them instead of creating a new comment.
218
227
228
+
### Update branch and workflow triggers
229
+
230
+
GitHub Actions uses slightly different checkout logic for different workflow triggers.
231
+
When using the `push` trigger, GitHub Actions checks out the branch that was pushed to.
232
+
But for [`pull_request` triggers][link-gha-trigger-pull], GitHub Actions might use a temporary branch name.
233
+
This affects in what "branch" your EAS Update is created when using the `--auto` flag.
234
+
219
235
### GitHub tokens
220
236
221
237
When using the GitHub API, you always need to be authenticated.
@@ -231,3 +247,5 @@ You can overwrite the token by adding the `GITHUB_TOKEN` environment variable or
0 commit comments