Compare commits

..
6 Commits
Author SHA1 Message Date
semantic-release-bot a522d656e4 chore: create new release 7.1.0
## [7.1.0](https://github.com/expo/expo-github-action/compare/7.0.3...7.1.0) (2022-03-04)

### New features

* add projectDeepLink to template variables ([#165](https://github.com/expo/expo-github-action/issues/165)) ([2603f85](https://github.com/expo/expo-github-action/commit/2603f858e975e61d8b7650b890db57c3afc5c658))

### Other chores

* run authed tests only when auth is available ([5815161](https://github.com/expo/expo-github-action/commit/58151613afb24812ce88afb33ed1a6b3f569128e))
* set major tag version to release commit ([b516013](https://github.com/expo/expo-github-action/commit/b5160133d207c9a70283880b33e34beb157cc7ea))
* skip steps if auth is unavailable ([bb7c723](https://github.com/expo/expo-github-action/commit/bb7c72336b557c49ca0a0e84025e1b4cce23ce2e))
* update github action author name ([#166](https://github.com/expo/expo-github-action/issues/166)) ([520d959](https://github.com/expo/expo-github-action/commit/520d9594e099c7b2475d8b376303466a187bcafa))
2022-03-04 17:07:21 +00:00
Cedric van Putten 58151613af chore: run authed tests only when auth is available 2022-03-04 15:46:06 +01:00
Giau. Tran Minh 2603f858e9 feature: add projectDeepLink to template variables (#165)
* feat: added projectDeepLink to template variables

* fix: updates from code review
2022-03-03 15:25:52 -08:00
Cedric van Putten 520d9594e0 chore: update github action author name (#166)
* chore: update default github action author name

* chore: update comment preview github action author name
2022-03-03 10:37:43 -08:00
Cedric van Putten b5160133d2 chore: set major tag version to release commit 2022-03-03 19:35:26 +01:00
Cedric van Putten bb7c72336b chore: skip steps if auth is unavailable
This is especially useful for external PR contributions
2022-03-03 19:26:50 +01:00
12 changed files with 101 additions and 20 deletions

No files matched your search

+1 -1
View File
@@ -86,4 +86,4 @@ jobs:
return semver.major(version)
- name: 📋 Update tags
run: git tag --force v${{ steps.version.outputs.result }} && git push --force --tags
run: git fetch --tags && git pull && git tag --force v${{ steps.version.outputs.result }} && git push --force --tags
+9 -2
View File
@@ -13,6 +13,9 @@ concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
hasAuth: ${{ !!secrets.EXPO_TOKEN }}
jobs:
setup:
strategy:
@@ -41,12 +44,14 @@ jobs:
run: eas --version
- name: 🧪 EAS authenticated
if: ${{ env.hasAuth == 'true' }}
run: eas whoami
- name: 🧪 Expo installed
run: expo --version
- name: 🧪 Expo authenticated
if: ${{ env.hasAuth == 'true' }}
run: expo whoami
preview-comment:
@@ -66,6 +71,7 @@ jobs:
run: expo init -t blank ./temp
- name: 🧪 Without commenting
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
id: preview
with:
@@ -73,6 +79,7 @@ jobs:
comment: false
- name: 🧪 Output has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v5
with:
script: |
@@ -80,6 +87,7 @@ jobs:
if (!message) throw new Error('Message output is empty')
- name: 🧪 Comment on PR (github-token)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
EXPO_TEST_GITHUB_PULL: 149
@@ -88,6 +96,7 @@ jobs:
channel: test
- name: 🧪 Comment on PR (GITHUB_TOKEN)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -96,5 +105,3 @@ jobs:
project: ./temp
channel: test
github-token: badtoken
+15
View File
@@ -1,3 +1,18 @@
## [7.1.0](https://github.com/expo/expo-github-action/compare/7.0.3...7.1.0) (2022-03-04)
### New features
* add projectDeepLink to template variables ([#165](https://github.com/expo/expo-github-action/issues/165)) ([2603f85](https://github.com/expo/expo-github-action/commit/2603f858e975e61d8b7650b890db57c3afc5c658))
### Other chores
* run authed tests only when auth is available ([5815161](https://github.com/expo/expo-github-action/commit/58151613afb24812ce88afb33ed1a6b3f569128e))
* set major tag version to release commit ([b516013](https://github.com/expo/expo-github-action/commit/b5160133d207c9a70283880b33e34beb157cc7ea))
* skip steps if auth is unavailable ([bb7c723](https://github.com/expo/expo-github-action/commit/bb7c72336b557c49ca0a0e84025e1b4cce23ce2e))
* update github action author name ([#166](https://github.com/expo/expo-github-action/issues/166)) ([520d959](https://github.com/expo/expo-github-action/commit/520d9594e099c7b2475d8b376303466a187bcafa))
### [7.0.3](https://github.com/expo/expo-github-action/compare/7.0.2...7.0.3) (2022-02-14)
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: Expo GitHub Action
author: Cedric van Putten <[email protected]>
author: Expo
description: Publish, build or manage your Expo app with GitHub Actions
branding:
icon: terminal
+14 -1
View File
@@ -15785,6 +15785,7 @@ async function commentAction(input = commentInput()) {
}
const variables = {
projectLink: (0, expo_1.projectLink)(project, input.channel),
projectDeepLink: (0, expo_1.projectDeepLink)(project, input.channel),
projectName: project.name,
projectOwner: project.owner || '',
projectQR: (0, expo_1.projectQR)(project, input.channel),
@@ -15828,7 +15829,7 @@ function template(template, replacements) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
@@ -15915,6 +15916,18 @@ function projectLink(project, channel) {
return url.toString();
}
exports.projectLink = projectLink;
/**
* Create a deep link to open the project in Expo Go
*/
function projectDeepLink(project, channel) {
(0, assert_1.ok)(project.owner, 'Could not create a deep link for project without owner');
const url = new url_1.URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
exports.projectDeepLink = projectDeepLink;
/***/ }),
+13 -1
View File
@@ -66905,7 +66905,7 @@ exports.handleCacheError = handleCacheError;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
@@ -66992,6 +66992,18 @@ function projectLink(project, channel) {
return url.toString();
}
exports.projectLink = projectLink;
/**
* Create a deep link to open the project in Expo Go
*/
function projectDeepLink(project, channel) {
(0, assert_1.ok)(project.owner, 'Could not create a deep link for project without owner');
const url = new url_1.URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
exports.projectDeepLink = projectDeepLink;
/***/ }),
+1 -1
View File
@@ -1,7 +1,7 @@
{
"private": true,
"name": "expo-github-action",
"version": "7.0.3",
"version": "7.1.0",
"description": "Expo CLI in your GitHub Actions workflow",
"main": "build/index.js",
"repository": {
+11 -10
View File
@@ -52,16 +52,17 @@ There are a few variables available to generate the comment content.
Some of these variables are also exported as subaction output.
Here is a summary of these variables.
| output name | template name | description |
| ---------------- | ---------------- | ---------------------------------------------------- |
| **projectOwner** | `{projectOwner}` | The resolved owner of the project |
| **projectSlug** | `{projectSlug}` | The resolved slug of the project |
| **projectName** | `{projectName}` | The resolved name of the project |
| **projectLink** | `{projectLink}` | The expo.dev project link, including release channel |
| **projectQR** | `{projectQR}` | The QR code link, to load the project in Expo Go |
| - | `{channel}` | The release channel that was used |
| **message** | - | The resolved message content |
| **messageId** | - | The resolved message id content |
| output name | template name | description |
| ---------------- | ---------------- | ----------------------------------------------------- |
| **projectOwner** | `{projectOwner}` | The resolved owner of the project |
| **projectSlug** | `{projectSlug}` | The resolved slug of the project |
| **projectName** | `{projectName}` | The resolved name of the project |
| **projectDeepLink** | `{projectDeepLink}` | A deep link to open the project in Expo Go |
| **projectLink** | `{projectLink}` | The expo.dev project link, including release channel |
| **projectQR** | `{projectQR}` | The QR code link, to load the project in Expo Go |
| - | `{channel}` | The release channel that was used |
| **message** | - | The resolved message content |
| **messageId** | - | The resolved message id content |
## Example workflows
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: Expo GitHub Action - Preview comment
author: Cedric van Putten <[email protected]>
author: Expo
description: Add Expo preview comments to pull requests
branding:
icon: message-circle
+2 -1
View File
@@ -1,6 +1,6 @@
import { getBooleanInput, getInput, setOutput, info } from '@actions/core';
import { projectInfo, projectLink, projectOwner, projectQR } from '../expo';
import { projectDeepLink, projectInfo, projectLink, projectOwner, projectQR } from '../expo';
import { createIssueComment, pullContext } from '../github';
import { executeAction } from '../worker';
@@ -34,6 +34,7 @@ export async function commentAction(input: CommentInput = commentInput()) {
const variables: Record<string, string> = {
projectLink: projectLink(project, input.channel),
projectDeepLink: projectDeepLink(project, input.channel),
projectName: project.name,
projectOwner: project.owner || '',
projectQR: projectQR(project, input.channel),
+14
View File
@@ -98,3 +98,17 @@ export function projectLink(project: ProjectInfo, channel?: string): string {
return url.toString();
}
/**
* Create a deep link to open the project in Expo Go
*/
export function projectDeepLink(project: ProjectInfo, channel?: string): string {
assert(project.owner, 'Could not create a deep link for project without owner');
const url = new URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
+19 -1
View File
@@ -2,7 +2,7 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import { authenticate, projectQR, projectLink } from '../src/expo';
import { authenticate, projectQR, projectLink, projectDeepLink } from '../src/expo';
jest.mock('@actions/core');
jest.mock('@actions/exec');
@@ -68,3 +68,21 @@ describe(projectLink, () => {
);
});
});
describe(projectDeepLink, () => {
it('throws when owner is undefined', () => {
expect(() => projectDeepLink({ name: 'fakename', slug: 'fakeslug' })).toThrow('without owner');
});
it('returns url with owner and slug', () => {
expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' })).toBe(
'exp://exp.host/@fakeowner/fakeslug'
);
});
it('returns url with owner, slug, and release channel', () => {
expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
'exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel'
);
});
});