mirror of
https://github.com/expo/expo-github-action.git
synced 2026-11-15 17:32:45 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
109c3edde0 | ||
|
|
d53d38f65b | ||
|
|
79348837ee | ||
|
|
7a46a499ec | ||
|
|
844ea09678 | ||
|
|
99593b8787 | ||
|
|
fd33d597d3 | ||
|
|
d50f5ddc11 | ||
|
|
e4ef6e6950 | ||
|
|
464821230f | ||
|
|
354dc08917 | ||
|
|
c2f11d2d51 | ||
|
|
72d406754f | ||
|
|
521de724fc | ||
|
|
633cdf0ac9 | ||
|
|
c5d2c0f8c0 | ||
|
|
439ff4c9aa | ||
|
|
3ae799926e | ||
|
|
3007741466 | ||
|
|
4908a48f1b | ||
|
|
3f9e947963 | ||
|
|
ee415b027a | ||
|
|
414c1693e6 | ||
|
|
4f28493708 | ||
|
|
3134e26b3a | ||
|
|
3bf9181edb | ||
|
|
39b0d361f7 | ||
|
|
f1fe877592 | ||
|
|
ff2ff0f980 | ||
|
|
1cfa7bbd9e | ||
|
|
8a7306a978 | ||
|
|
c20146f3b7 | ||
|
|
a9b9cfef50 | ||
|
|
3b3e6b8031 | ||
|
|
186ef0011a | ||
|
|
45b79a05ef | ||
|
|
0b1822a935 | ||
|
|
b60246939f | ||
|
|
b099f17d58 | ||
|
|
50c0ef9028 | ||
|
|
92ec93fa37 | ||
|
|
5f5673ba77 | ||
|
|
1c8e5a21e9 | ||
|
|
3ba667b43f | ||
|
|
f14253ea9c | ||
|
|
a2d9b1cadf | ||
|
|
def44e2c77 | ||
|
|
c3c02de017 | ||
|
|
8b43bae073 | ||
|
|
a03876e3c5 | ||
|
|
04692c3cb1 | ||
|
|
1b57c37e9b | ||
|
|
76ce4de80e |
No files matched your search
+1
-9
@@ -3,14 +3,6 @@ root = true
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
+2
-25
@@ -1,27 +1,4 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'jest',
|
||||
],
|
||||
env: {
|
||||
es6: true,
|
||||
'jest/globals': true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-member-accessibility': [
|
||||
'error', { 'accessibility': 'no-public' },
|
||||
],
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/indent': ['error', 'tab'],
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
ignorePatterns: ['build/**', 'node_modules/**'],
|
||||
extends: ['universe/node'],
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
# Handle line endings automatically for files detected as text
|
||||
# and leave all files detected as binary untouched.
|
||||
* text=auto
|
||||
|
||||
# These files are text and should be normalized (Convert crlf => lf)
|
||||
build/** text eol=lf
|
||||
@@ -1,55 +0,0 @@
|
||||
---
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
build:
|
||||
name: Test and build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12, 14]
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
include:
|
||||
- node: 14
|
||||
os: macos-latest
|
||||
checkUpToDate: true
|
||||
- node: 14
|
||||
os: ubuntu-latest
|
||||
checkUpToDate: true
|
||||
steps:
|
||||
- name: Setup repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Find cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
- name: Lint package
|
||||
run: yarn lint
|
||||
- name: Test package
|
||||
run: yarn test
|
||||
- name: Build clean
|
||||
run: yarn clean
|
||||
- name: Build package
|
||||
run: yarn build
|
||||
- name: Build up-to-date
|
||||
if: ${{ matrix.checkUpToDate }}
|
||||
run: git diff --stat --exit-code build
|
||||
@@ -1,51 +1,40 @@
|
||||
---
|
||||
name: Release
|
||||
name: release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
description: 'type "release" to confirm creating a new release (main branch only)'
|
||||
description: 'type "release" to create the release (main branch only)'
|
||||
required: false
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release version
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup repo
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v1
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- name: Find cache
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install dependencies
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
- name: Lint package
|
||||
run: yarn lint
|
||||
- name: Test package
|
||||
run: yarn test
|
||||
- name: Build clean
|
||||
run: yarn clean
|
||||
- name: Build package
|
||||
run: yarn build
|
||||
- name: Build up-to-date
|
||||
run: git diff --stat --exit-code build
|
||||
- name: Test-run release
|
||||
if: success() && github.event.inputs.release != 'release'
|
||||
|
||||
- name: 📋 Dry-running release
|
||||
if: ${{ github.ref != 'refs/heads/main' || github.event.inputs.release != 'release' }}
|
||||
run: yarn semantic-release --dry-run
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create release
|
||||
if: success() && github.event.inputs.release == 'release' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
|
||||
|
||||
- name: 📋 Release code
|
||||
if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }}
|
||||
run: yarn semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,56 @@
|
||||
name: review
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: review-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
node: [16.x]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
|
||||
- name: ✅ Lint code
|
||||
run: yarn lint
|
||||
|
||||
- name: 🧪 Test code
|
||||
run: yarn test
|
||||
|
||||
- name: 👷 Build code
|
||||
run: yarn clean && yarn build
|
||||
|
||||
- name: 🕵️ Validate build
|
||||
id: diff
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol build/ | wc -l)" -gt "0" ]; then
|
||||
echo "⚠️ Build is outdated"
|
||||
echo " > run 'yarn clean', 'yarn build', and commit changes"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 🗂 Upload build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: build
|
||||
path: build/
|
||||
@@ -0,0 +1,89 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 15 * * *'
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: test-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
cache:
|
||||
- with-cache
|
||||
- without-cache
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: ./
|
||||
with:
|
||||
eas-version: latest
|
||||
eas-cache: ${{ matrix.cache == 'with-cache' }}
|
||||
expo-version: latest
|
||||
expo-cache: ${{ matrix.cache == 'with-cache' }}
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 🧪 EAS installed
|
||||
run: eas --version
|
||||
|
||||
- name: 🧪 EAS authenticated
|
||||
run: eas whoami
|
||||
|
||||
- name: 🧪 Expo installed
|
||||
run: expo --version
|
||||
|
||||
- name: 🧪 Expo authenticated
|
||||
run: expo whoami
|
||||
|
||||
preview-comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: ./
|
||||
with:
|
||||
eas-version: latest
|
||||
expo-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 🏗 Setup project
|
||||
run: expo init -t blank ./temp
|
||||
|
||||
- name: 🧪 Without commenting
|
||||
uses: ./preview-comment
|
||||
id: preview
|
||||
with:
|
||||
project: ./temp
|
||||
comment: false
|
||||
|
||||
- name: 🧪 Output has content
|
||||
uses: actions/github-script@v5
|
||||
with:
|
||||
script: |
|
||||
const message = `${{ steps.preview.outputs.message }}`
|
||||
if (!message) throw new Error('Message output is empty')
|
||||
|
||||
- name: 🧪 Comment on PR
|
||||
uses: ./preview-comment
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
EXPO_TEST_GITHUB_PULL: 149
|
||||
with:
|
||||
project: ./temp
|
||||
channel: test
|
||||
|
||||
|
||||
+50
@@ -1 +1,51 @@
|
||||
# SWC
|
||||
.swc/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Node
|
||||
node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
|
||||
# Ruby
|
||||
.direnv
|
||||
|
||||
# Emacs
|
||||
*~
|
||||
|
||||
# Vim
|
||||
.*.swp
|
||||
.*.swo
|
||||
.*.swn
|
||||
.*.swm
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
# Xcode
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
xcuserdata
|
||||
|
||||
# Android Studio
|
||||
*.iml
|
||||
.gradle
|
||||
.idea/libraries
|
||||
.idea/workspace.xml
|
||||
.idea/gradle.xml
|
||||
.idea/misc.xml
|
||||
.idea/modules.xml
|
||||
.idea/vcs.xml
|
||||
|
||||
# Eclipse
|
||||
.project
|
||||
.settings
|
||||
|
||||
# VSCode
|
||||
.history/
|
||||
@@ -1 +0,0 @@
|
||||
_
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn build
|
||||
git add build
|
||||
+3
-2
@@ -2,7 +2,8 @@
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"jsxBracketSameLine": true,
|
||||
"bracketSameLine": true,
|
||||
"trailingComma": "es5",
|
||||
"arrowParens": "avoid"
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
+9
-3
@@ -11,12 +11,17 @@ const rules = [
|
||||
const sortMap = Object.fromEntries(rules.map((rule, index) => [rule.title, index]));
|
||||
|
||||
module.exports = {
|
||||
branches: ['main', 'master'],
|
||||
branches: ['main'],
|
||||
tagFormat: '${version}',
|
||||
plugins: [
|
||||
['@semantic-release/commit-analyzer', {
|
||||
preset: 'conventionalcommits',
|
||||
releaseRules: rules.map(({ type, release }) => ({ type, release })),
|
||||
releaseRules: [
|
||||
{ breaking: true, release: 'major' },
|
||||
{ revert: true, release: 'patch' },
|
||||
].concat(
|
||||
rules.map(({ type, release, breaking }) => ({ type, release, breaking }))
|
||||
),
|
||||
}],
|
||||
['@semantic-release/release-notes-generator', {
|
||||
preset: 'conventionalcommits',
|
||||
@@ -29,9 +34,10 @@ module.exports = {
|
||||
}],
|
||||
'@semantic-release/changelog',
|
||||
['@semantic-release/npm', { npmPublish: false }],
|
||||
["@semantic-release/exec", { publishCmd: 'yarn build' }],
|
||||
['@semantic-release/git', {
|
||||
message: 'chore: create new release ${nextRelease.version}\n\n${nextRelease.notes}',
|
||||
assets: ['package.json', 'CHANGELOG.md'],
|
||||
assets: ['package.json', 'CHANGELOG.md', 'build/*'],
|
||||
}],
|
||||
'@semantic-release/github',
|
||||
],
|
||||
|
||||
+111
@@ -1,3 +1,114 @@
|
||||
### [7.0.1](https://github.com/expo/expo-github-action/compare/7.0.0...7.0.1) (2022-01-17)
|
||||
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* remove double resolving package versions ([#152](https://github.com/expo/expo-github-action/issues/152)) ([d53d38f](https://github.com/expo/expo-github-action/commit/d53d38f65bc6add70cdb1eb0fb1caadd3eae9ae4))
|
||||
|
||||
|
||||
### Other chores
|
||||
|
||||
* run test workflow every day at 15:00 utc ([fd33d59](https://github.com/expo/expo-github-action/commit/fd33d597d339279a12768e1b3c99e051324dc8ba))
|
||||
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* explicitly add non interactive flag ([#151](https://github.com/expo/expo-github-action/issues/151)) ([844ea09](https://github.com/expo/expo-github-action/commit/844ea09678511192c3685351e3eedd0c92dd4d7d))
|
||||
* update comment preview readme header ([7a46a49](https://github.com/expo/expo-github-action/commit/7a46a499ece6b413f5c6fb05951606c95546e03e))
|
||||
* update step title in example with eas cli ([7934883](https://github.com/expo/expo-github-action/commit/79348837ee612ad7393e64b3ed04a93519982fe6))
|
||||
* update workflow badge with test status ([99593b8](https://github.com/expo/expo-github-action/commit/99593b87875c2d5cb38c2b111cf8bdf85ab54b1c))
|
||||
|
||||
## [7.0.0](https://github.com/expo/expo-github-action/compare/6.0.0...7.0.0) (2022-01-15)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* some input options are deprecated
|
||||
- Username and password authentication is dropped in favor of tokens
|
||||
- Custom cache keys are dropped
|
||||
- Custom install error handler is dropped
|
||||
|
||||
### New features
|
||||
|
||||
* add comment qr code subaction ([#149](https://github.com/expo/expo-github-action/issues/149)) ([4648212](https://github.com/expo/expo-github-action/commit/464821230fc5d4c4d848dcf20c5146bf99fd38ce))
|
||||
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* use which instead of npx to authenticate ([#147](https://github.com/expo/expo-github-action/issues/147)) ([c5d2c0f](https://github.com/expo/expo-github-action/commit/c5d2c0f8c034b625147bc4b2ccd6d14a29412a1d))
|
||||
|
||||
|
||||
### Code changes
|
||||
|
||||
* allow multiple entrypoints for different sub-actions ([#121](https://github.com/expo/expo-github-action/issues/121)) ([8a7306a](https://github.com/expo/expo-github-action/commit/8a7306a97854f9b2853a614d3302061922471a8f))
|
||||
* clean up setup action ([#146](https://github.com/expo/expo-github-action/issues/146)) ([439ff4c](https://github.com/expo/expo-github-action/commit/439ff4c9aa508ea6f38364859109267d8f26fcf1))
|
||||
* enable caches by default ([#148](https://github.com/expo/expo-github-action/issues/148)) ([72d4067](https://github.com/expo/expo-github-action/commit/72d406754f3b10aeff9b54a2b3e3e833d4cd3c9f))
|
||||
* replace libnpm with npm cli ([#139](https://github.com/expo/expo-github-action/issues/139)) ([4f28493](https://github.com/expo/expo-github-action/commit/4f28493708de28b8eebd418702ec8eb93660927d))
|
||||
* roll back to ncc because of swc bundling issues ([#144](https://github.com/expo/expo-github-action/issues/144)) ([3007741](https://github.com/expo/expo-github-action/commit/3007741466570f1bf8f3cf7417e56c7aab50b60a))
|
||||
* update the outdated workflows and use node 16 ([#138](https://github.com/expo/expo-github-action/issues/138)) ([3134e26](https://github.com/expo/expo-github-action/commit/3134e26b3a41fcc058c60c0f34f87c8d44189d3c))
|
||||
* upgrade to node 16 github actions runtime ([#137](https://github.com/expo/expo-github-action/issues/137)) ([3bf9181](https://github.com/expo/expo-github-action/commit/3bf9181edb0df2dcaf9112b50c9d2a9996db8a32))
|
||||
* use assert instead of if statements ([#150](https://github.com/expo/expo-github-action/issues/150)) ([e4ef6e6](https://github.com/expo/expo-github-action/commit/e4ef6e6950f602a6277c6e35dbd36ca3fa8ccb8e))
|
||||
* use boolean input instead of manual conversion ([#127](https://github.com/expo/expo-github-action/issues/127)) ([f1fe877](https://github.com/expo/expo-github-action/commit/f1fe8775927c95727008dfe31f580c122913a745))
|
||||
* use spaces for indentation ([#126](https://github.com/expo/expo-github-action/issues/126)) ([ff2ff0f](https://github.com/expo/expo-github-action/commit/ff2ff0f980f70d0047d10637dd5ef915128199ec))
|
||||
* use swc pack instead of ncc ([#140](https://github.com/expo/expo-github-action/issues/140)) ([3f9e947](https://github.com/expo/expo-github-action/commit/3f9e9479631f03a941ecfebdcd0351ef57f59a2e))
|
||||
|
||||
|
||||
### Other chores
|
||||
|
||||
* add basic e2e test workflow for main action ([#141](https://github.com/expo/expo-github-action/issues/141)) ([414c169](https://github.com/expo/expo-github-action/commit/414c1693e6183ad92723fca4517181b21f93eaf0))
|
||||
* add manual trigger to the tests ([4908a48](https://github.com/expo/expo-github-action/commit/4908a48f1b5e1ccff9589c0fcaafe4223d53bee1))
|
||||
* always use lf for build files ([#122](https://github.com/expo/expo-github-action/issues/122)) ([a9b9cfe](https://github.com/expo/expo-github-action/commit/a9b9cfef50ba2c1d38fff1a679c554eb52edc25e))
|
||||
* bump semver-regex from 3.1.2 to 3.1.3 ([#114](https://github.com/expo/expo-github-action/issues/114)) ([50c0ef9](https://github.com/expo/expo-github-action/commit/50c0ef9028d51bd25197c54102438f494c265438))
|
||||
* bump tar from 4.4.13 to 4.4.19 ([#112](https://github.com/expo/expo-github-action/issues/112)) ([5f5673b](https://github.com/expo/expo-github-action/commit/5f5673ba7744a05d9c499fbca7b4e503aabef5a1))
|
||||
* bump tmpl from 1.0.4 to 1.0.5 ([#115](https://github.com/expo/expo-github-action/issues/115)) ([92ec93f](https://github.com/expo/expo-github-action/commit/92ec93fa37744783ec10149e7d755d7181649f8a))
|
||||
* clean up dependencies and eslint rules ([#145](https://github.com/expo/expo-github-action/issues/145)) ([3ae7999](https://github.com/expo/expo-github-action/commit/3ae799926e78cfecd54e965c77d1c1fb49cac45b))
|
||||
* clean up master references in release and workflows ([#104](https://github.com/expo/expo-github-action/issues/104)) ([a2d9b1c](https://github.com/expo/expo-github-action/commit/a2d9b1cadf463af1e6b4025af3edc99cf7f4b5a0))
|
||||
* clean up tsconfig and eslint rules ([#123](https://github.com/expo/expo-github-action/issues/123)) ([c20146f](https://github.com/expo/expo-github-action/commit/c20146f3b7513ae3a3df3dead651d2a2dea988af))
|
||||
* lint root files with prettier and eslint ([#125](https://github.com/expo/expo-github-action/issues/125)) ([1cfa7bb](https://github.com/expo/expo-github-action/commit/1cfa7bbd9ed623e2e40406addab4bff2c9a7b2fd))
|
||||
* rebuild project ([45b79a0](https://github.com/expo/expo-github-action/commit/45b79a05ef7496339d33d03fdd7755ef76c7038b))
|
||||
* rebuild project after dependency bumps ([b099f17](https://github.com/expo/expo-github-action/commit/b099f17d588e23df069b60d39ca1e21327066a4f))
|
||||
* remove husky and improve ci build message ([#128](https://github.com/expo/expo-github-action/issues/128)) ([39b0d36](https://github.com/expo/expo-github-action/commit/39b0d361f7d97ef1a71a02495463d1e93a72093a))
|
||||
* simplify review and update build detection ([#142](https://github.com/expo/expo-github-action/issues/142)) ([ee415b0](https://github.com/expo/expo-github-action/commit/ee415b027afce4c15cabcc6fa2f8368530a36c08))
|
||||
* update `setup-node` action to `v2` release ([#119](https://github.com/expo/expo-github-action/issues/119)) ([3b3e6b8](https://github.com/expo/expo-github-action/commit/3b3e6b8031b898cdf0bc59488d541d90748954b9))
|
||||
* update semantic release to update the build ([354dc08](https://github.com/expo/expo-github-action/commit/354dc0891761b8d1fc092ec5e9bb3b5ca1922090))
|
||||
* update the action manifest ([633cdf0](https://github.com/expo/expo-github-action/commit/633cdf0ac9f283f5a7010fef11bfda9174278054))
|
||||
* upgrade dev dependencies and rebuild action ([#120](https://github.com/expo/expo-github-action/issues/120)) ([186ef00](https://github.com/expo/expo-github-action/commit/186ef0011a259a7b2c745f8cf2743358ca112530))
|
||||
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* fix broken sup element in readme ([0b1822a](https://github.com/expo/expo-github-action/commit/0b1822a93580171a0582013a0cf7848cf3503ed7))
|
||||
* fix github capitalization ([#116](https://github.com/expo/expo-github-action/issues/116)) ([b602469](https://github.com/expo/expo-github-action/commit/b60246939fba50e600b11596b4b1029091017b7c))
|
||||
* fix unsplash comment on pr branch reference ([#110](https://github.com/expo/expo-github-action/issues/110)) ([f14253e](https://github.com/expo/expo-github-action/commit/f14253ea9c17296e843610c7b8fad4e13c7abda0))
|
||||
* update default values in readme ([c2f11d2](https://github.com/expo/expo-github-action/commit/c2f11d2d513b75ec0a00c6bf60e5d0e275c3a8af))
|
||||
* update expo.io links to expo.dev ([#111](https://github.com/expo/expo-github-action/issues/111)) ([1c8e5a2](https://github.com/expo/expo-github-action/commit/1c8e5a21e9689cedd8fbcf61e50a3f4700b6bc41))
|
||||
* update node version reference in readme ([#107](https://github.com/expo/expo-github-action/issues/107)) ([3ba667b](https://github.com/expo/expo-github-action/commit/3ba667b43f1e103a1c64e92a60d7c36bd0ad10b2))
|
||||
* update readme and contributing guides ([521de72](https://github.com/expo/expo-github-action/commit/521de724fcb79235773c077e870d7c2293ab51cb))
|
||||
* use `main` branch to update `v{major}` tag ([#103](https://github.com/expo/expo-github-action/issues/103)) ([def44e2](https://github.com/expo/expo-github-action/commit/def44e2c77a39f5bd48dbb07adec509137afcf67))
|
||||
|
||||
## [6.0.0](https://github.com/expo/expo-github-action/compare/5.5.1...6.0.0) (2021-06-22)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* GitHub Action inputs are changed to allow both Expo and EAS CLI.
|
||||
|
||||
### New features
|
||||
|
||||
* add support for eas cli installs ([#98](https://github.com/expo/expo-github-action/issues/98)) ([04692c3](https://github.com/expo/expo-github-action/commit/04692c3cb1f7ad977f62841ca0bb175c903f653f))
|
||||
|
||||
|
||||
### Other chores
|
||||
|
||||
* update node to 14 and 16 in ci ([#100](https://github.com/expo/expo-github-action/issues/100)) ([a03876e](https://github.com/expo/expo-github-action/commit/a03876e3c556bea147f2be007eac911bf78c9b23))
|
||||
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* add commands to contirbuting guide for updating v{major} tags ([1b57c37](https://github.com/expo/expo-github-action/commit/1b57c37e9bdfe92e183befb3595debc64da672f0))
|
||||
* update readme for v6 release ([#101](https://github.com/expo/expo-github-action/issues/101)) ([8b43bae](https://github.com/expo/expo-github-action/commit/8b43bae073f280d4fa76aa174642ad46febe985c))
|
||||
* update upstream reference in contributing guide ([76ce4de](https://github.com/expo/expo-github-action/commit/76ce4de80ea89b343404cdabadc922882af80487))
|
||||
|
||||
### [5.5.1](https://github.com/expo/expo-github-action/compare/5.5.0...5.5.1) (2021-06-17)
|
||||
|
||||
|
||||
|
||||
+15
-8
@@ -1,8 +1,8 @@
|
||||
# Contributing to Expo Github Action
|
||||
# Contributing to Expo GitHub Action
|
||||
|
||||
## 📦 Download and Setup
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device. (`git remote add upstream [email protected]:expo/vscode-expo.git` 😉)
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device. (`git remote add upstream [email protected]:expo/expo-github-action.git` 😉)
|
||||
2. Make sure you have the following packages globally installed on your system:
|
||||
- [node](https://nodejs.org/) (active Node LTS or higher is recommended)
|
||||
- [yarn](https://yarnpkg.com/)
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
## 🏎️ Running a custom version
|
||||
|
||||
To try out your changed with Github Action, you have [to reference your fork and/or branch or commit reference](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#using-release-management-for-your-custom-actions) in the workflow you want to try. After that, you have two options:
|
||||
To try out your changes with GitHub Action, you have [to reference your fork and/or branch or commit reference](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#using-release-management-for-your-custom-actions) in the workflow you want to try. After that, you have two options:
|
||||
|
||||
1. Run the workflow in Github Actions itself by triggering your workflow.
|
||||
1. Run the workflow in GitHub Actions itself by triggering your workflow.
|
||||
2. Run the workflow locally with [nektos/act](https://github.com/nektos/act).
|
||||
|
||||
## ✅ Testing
|
||||
## 🧪 Testing
|
||||
|
||||
Testing is done using [Jest](https://jestjs.io/https://jestjs.io/). Run `yarn test` to run Jest.
|
||||
|
||||
In CI we are running tests on multiple Node versions using Windows, Linux, and MacOS. Make sure they are passing for your PR.
|
||||
If your PR is ready, run the **test** workflow to test the workflows on all supported OS system.
|
||||
|
||||
## 📝 Writing a Commit Message
|
||||
|
||||
@@ -45,6 +45,13 @@ To get your PR merged as fast as possible, please make sure you have done the fo
|
||||
|
||||
## 🚀 Releasing a new version
|
||||
|
||||
To release a new version for Github Actions, we have to create a new release in Github. You can run the `Release` workflow to generate a new version, changelog, and Github release.
|
||||
To release a new version for GitHub Actions, we have to create a new release in GitHub. You can run the `Release` workflow to generate a new version, changelog, and GitHub release.
|
||||
|
||||
After the exact version tag is created, update the `v{major}` tag to the latest major version.
|
||||
After the exact version tag is created, update the `v{major}` tag to the latest major version. Make sure you are on the default branch at the commit of versioning.
|
||||
|
||||
```bash
|
||||
$ git checkout main
|
||||
$ git fetch --tags && git pull
|
||||
$ git tag --force v{major}
|
||||
$ git push --force --tags
|
||||
```
|
||||
@@ -1,278 +1,204 @@
|
||||
<div align="center">
|
||||
<h1>expo github action</h1>
|
||||
<p></p>
|
||||
<p>Publish, build or manage your <a href="https://github.com/expo/expo">Expo</a> app with Github Actions!</p>
|
||||
<sup>
|
||||
<h1>expo-github-action</h1>
|
||||
<p>Publish, build or manage your <a href="https://github.com/expo/expo">Expo</a> app with GitHub Actions!</p>
|
||||
<p>
|
||||
<a href="https://github.com/expo/expo-github-action/releases">
|
||||
<img src="https://img.shields.io/github/release/expo/expo-github-action/all.svg?style=flat-square" alt="releases" />
|
||||
<img src="https://img.shields.io/github/v/release/expo/expo-github-action" alt="releases" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/actions">
|
||||
<img src="https://img.shields.io/github/workflow/status/expo/expo-github-action/CI/master.svg?style=flat-square" alt="builds" />
|
||||
<img src="https://img.shields.io/github/workflow/status/expo/expo-github-action/test" alt="builds" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/blob/master/LICENSE.md">
|
||||
<img src="https://img.shields.io/github/license/expo/expo-github-action?style=flat-square" alt="license" />
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/LICENSE.md">
|
||||
<img src="https://img.shields.io/github/license/expo/expo-github-action" alt="license" />
|
||||
</a>
|
||||
</sup>
|
||||
<br />
|
||||
<p align="center">
|
||||
<a href="https://github.com/expo/expo-github-action#configuration-options"><b>Usage</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action#example-workflows"><b>Examples</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action#things-to-know"><b>Caveats</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action/blob/master/CHANGELOG.md"><b>Changelog</b></a>
|
||||
</p>
|
||||
<br />
|
||||
<p align="center">
|
||||
<a href="#configuration-options"><b>Usage</b></a>
|
||||
—
|
||||
<a href="#example-workflows"><b>Examples</b></a>
|
||||
—
|
||||
<a href="#things-to-know"><b>Caveats</b></a>
|
||||
—
|
||||
<a href="/blob/main/CHANGELOG.md"><b>Changelog</b></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## What's inside?
|
||||
|
||||
With this Expo action, you have full access to the [Expo CLI][link-expo-cli] itself.
|
||||
It allows you to fully automate the `expo publish` or `expo build` process, leaving you with more time available for your project.
|
||||
There are some additional features included to make the usage of this action as simple as possible, like caching and authentication.
|
||||
With this Expo action, you have full access to [Expo CLI][link-expo-cli] and [EAS CLI][link-eas-cli].
|
||||
It lets you automate the `expo publish` or `eas build` commands, leaving you with more time to work on your project.
|
||||
Some additional features are included to make the usage of this action as simple as possible, like caching and authentication.
|
||||
|
||||
## Configuration options
|
||||
|
||||
This action is customizable through variables; they are defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the variables that you can use and their purpose.
|
||||
This action is customizable through variables defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the input options you can use.
|
||||
|
||||
variable | default | description
|
||||
--- | --- | ---
|
||||
`expo-username` | - | The username of your Expo account _(e.g. `bycedric`)_
|
||||
`expo-token` | - | The token of your Expo account _(e.g. [`${{ secrets.EXPO_TOKEN }}`][link-actions-secrets])_
|
||||
`expo-password` | - | The password of your Expo account _(e.g. [`${{ secrets.EXPO_CLI_PASSWORD }}`][link-actions-secrets])_
|
||||
`expo-version` | `latest` | The Expo CLI version to use, can be any [SemVer][link-semver-playground]. _(e.g. `3.x`)_
|
||||
`expo-packager` | `yarn` | The package manager to install the CLI with. _(e.g. `npm`)_
|
||||
`expo-cache` | `false` | If it should use the [GitHub actions (remote) cache](#using-the-built-in-cache).
|
||||
`expo-cache-key` | - | An optional custom (remote) cache key. _(**use with caution**)_
|
||||
`expo-patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux).
|
||||
|
||||
> Never hardcode `expo-token` or `expo-password` in your workflow, use [secrets][link-actions-secrets] to store them.
|
||||
|
||||
> It's also recommended to set the `expo-version` to avoid breaking changes when a new major version is released.
|
||||
| variable | default | description |
|
||||
| ------------------ | ------- | --------------------------------------------------------------------------------------------- |
|
||||
| **expo-version** | - | Expo CLI version to install _(skips when omitted)_ |
|
||||
| **expo-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
|
||||
| **eas-version** | - | EAS CLI version to install _(skips when omitted)_ |
|
||||
| **eas-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
|
||||
| **packager** | `yarn` | Package manager to use _(e.g. `yarn` or `npm`)_ |
|
||||
| **token** | - | Token of your Expo account _(only use with [secrets][link-actions-secrets])_ |
|
||||
| **patch-watchers** | `true` | If it should patch the `fs.inotify.*` limits on Ubuntu ([read more](#enospc-errors-on-linux)) |
|
||||
|
||||
## Example workflows
|
||||
|
||||
Before you dive into the workflow examples, you should know the basics of GitHub Actions.
|
||||
Before diving into the workflow examples, you should know the basics of GitHub Actions.
|
||||
You can read more about this in the [GitHub Actions documentation][link-actions].
|
||||
|
||||
1. [Publish on any push to master](#publish-on-any-push-to-master)
|
||||
2. [Cache Expo CLI for other jobs](#cache-expo-cli-for-other-jobs)
|
||||
3. [Test PRs and publish a review version](#test-prs-and-publish-a-review-version)
|
||||
4. [Test PRs on multiple nodes and systems](#test-prs-on-multiple-nodes-and-systems)
|
||||
5. [Test and build web every day at 08:00](#test-and-build-web-every-day-at-0800)
|
||||
6. [Authenticate using an Expo token](#authenticate-using-an-expo-token)
|
||||
1. [Publish on any push to main](#publish-on-any-push-to-main)
|
||||
2. [Creating a new EAS build](#creating-a-new-eas-build)
|
||||
3. [Publish a preview from PR](#publish-a-preview-from-PR)
|
||||
|
||||
### Publish on any push to master
|
||||
### Publish on any push to main
|
||||
|
||||
Below you can see the example configuration to publish whenever the master branch is updated.
|
||||
The workflow listens to the `push` event and sets up Node 12 using the [Setup Node Action][link-actions-node].
|
||||
It also authenticates the Expo project by defining both `expo-username` and `expo-password`.
|
||||
This workflow listens to the `push` event on the `main` branch.
|
||||
It sets up all required components to publish the app, including authentication with a token.
|
||||
|
||||
> Always use [secrets][link-actions-secrets] when using tokens.
|
||||
|
||||
```yml
|
||||
name: Expo Publish
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
jobs:
|
||||
publish:
|
||||
name: Install and publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: expo/expo-github-action@v5
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: expo/expo-github-action@v7
|
||||
with:
|
||||
expo-version: 4.x
|
||||
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
|
||||
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
|
||||
- run: yarn install
|
||||
- run: expo publish
|
||||
expo-version: 5.x
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: 🚀 Publish app
|
||||
run: expo publish --non-interactive
|
||||
```
|
||||
|
||||
### Cache Expo CLI for other jobs
|
||||
### Creating a new EAS build
|
||||
|
||||
Below you can see a slightly modified version of the example above.
|
||||
In this one, we enabled the built-in cache that will reuse a previously installed Expo CLI.
|
||||
It skips the installation part and extracts the files directly, boosting the performance of your workflow.
|
||||
This action also allows you to install the EAS CLI.
|
||||
To do this, add the **eas-version** property, and the action will install it.
|
||||
We recommend using `latest` for the EAS CLI.
|
||||
|
||||
> You can [read more about the cache here](#using-the-built-in-cache)
|
||||
> The **token** is shared for both Expo and EAS CLI.
|
||||
|
||||
```yml
|
||||
name: Expo Publish
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
jobs:
|
||||
publish:
|
||||
name: Install and publish
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: expo/expo-github-action@v5
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 🏗 Setup Expo and EAS
|
||||
uses: expo/expo-github-action@v7
|
||||
with:
|
||||
expo-version: 4.x
|
||||
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
|
||||
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
|
||||
expo-cache: true
|
||||
- run: yarn install
|
||||
- run: expo publish
|
||||
expo-version: 5.x
|
||||
eas-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: 🚀 Build app
|
||||
run: eas build --non-interactive
|
||||
```
|
||||
|
||||
### Test PRs and publish a review version
|
||||
### Publish a preview from PR
|
||||
|
||||
Reviewing pull requests can take some time if you have to read every line of code.
|
||||
To make this easier, you can publish the edited version of the PR using a [release channel][link-expo-release-channels].
|
||||
Below you can see an example of a workflow that publishes and comments on te PR when the app is published.
|
||||
Reviewing pull requests can take some time.
|
||||
The reviewer needs to check out the branch, install the changes, and run the bundler to review the results.
|
||||
You can also automatically publish the project for the reviewer to skip those manual steps.
|
||||
|
||||
This workflow publishes the changes on the `pr-#` [release channel][link-expo-release-channels] and adds a comment to the pull request once it's ready for review.
|
||||
|
||||
> See the [preview-comment docs](./preview-comment).
|
||||
|
||||
```yml
|
||||
name: Expo Review
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
publish:
|
||||
name: Install and publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: expo/expo-github-action@v5
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: expo/expo-github-action@v7
|
||||
with:
|
||||
expo-version: 4.x
|
||||
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
|
||||
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
|
||||
- run: yarn install
|
||||
- run: expo publish --release-channel=pr-${{ github.event.number }}
|
||||
- uses: unsplash/comment-on-pr@master
|
||||
expo-version: 5.x
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: 🚀 Publish preview
|
||||
run: expo publish --release-channel=pr-${{ github.event.number }} --non-interactive
|
||||
|
||||
- name: 💬 Comment preview
|
||||
uses: expo/expo-github-action/preview-comment@v7
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
msg: App is ready for review, you can [see it here](https://expo.io/@bycedric/use-expo?release-channel=pr-${{ github.event.number }}).
|
||||
```
|
||||
|
||||
### Test PRs on multiple nodes and systems
|
||||
|
||||
With GitHub Actions, it's reasonably easy to set up a matrix build and test the app on multiple environments.
|
||||
These matrixes can help to make sure your app runs smoothly on a broad set of different development machines.
|
||||
|
||||
> If you don't need automatic authentication, you can omit the `expo-username` and `expo-password` variables.
|
||||
|
||||
```yml
|
||||
name: Expo CI
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
ci:
|
||||
name: Continuous Integration
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
node: [10, 12, 13]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- uses: expo/expo-github-action@v5
|
||||
with:
|
||||
expo-version: 4.x
|
||||
- run: yarn install
|
||||
- run: yarn test
|
||||
- run: expo doctor
|
||||
```
|
||||
|
||||
### Test and build web every day at 08:00
|
||||
|
||||
You can also schedule jobs by using the cron syntax.
|
||||
It can help to minimize the number of updates your users have to install.
|
||||
|
||||
```yml
|
||||
name: Expo Daily CI
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 8 * * *
|
||||
jobs:
|
||||
ci:
|
||||
name: Daily Continuous Integration
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: expo/expo-github-action@v5
|
||||
with:
|
||||
expo-version: 4.x
|
||||
- run: yarn install
|
||||
- run: yarn test
|
||||
- run: expo build:web
|
||||
```
|
||||
|
||||
### Authenticate using an Expo token
|
||||
|
||||
Instead of username and password, you can also authenticate using a token.
|
||||
This might help increasing security and avoids adding username and password to your repository secrets.
|
||||
|
||||
```yml
|
||||
name: Expo Publish
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
publish:
|
||||
name: Install and publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: expo/expo-github-action@v5
|
||||
with:
|
||||
expo-version: 4.x
|
||||
expo-token: ${{ secrets.EXPO_TOKEN }}
|
||||
- run: yarn install
|
||||
- run: expo publish
|
||||
channel: pr-${{ github.event.number }}
|
||||
```
|
||||
|
||||
## Things to know
|
||||
|
||||
### Automatic Expo login
|
||||
|
||||
You need to authenticate for some Expo commands like `expo publish` and `expo build`.
|
||||
This action gives you configuration options to keep your workflow simple.
|
||||
You can choose if you want to authenticate using an `EXPO_TOKEN` or account credentials.
|
||||
Under the hood, it uses the [`EXPO_CLI_PASSWORD`][link-expo-cli-password] environment variable to make credentials authentication as secure as possible.
|
||||
Some Expo commands, like `expo publish` and `eas build`, require you to be authenticated.
|
||||
This action exports the **token** to ensure you are authenticated in every workflow step.
|
||||
|
||||
> Note, this action only uses your token or credentials to authenticate with Expo. It doesn't store these anywhere.
|
||||
> Note, this action does not store the token anywhere. Each separate workflow job needs to set up the **token** individually.
|
||||
|
||||
### Using the built-in cache
|
||||
|
||||
You can opt-in to caching the installation, making it a lot faster.
|
||||
Under the hood, it uses the [`@action/cache`][link-actions-cache-package] package to restore the Expo CLI installation.
|
||||
This action generates a unique cache key for the OS, used packager, and exact version of the Expo CLI.
|
||||
If you need more control over this cache, you can define a custom cache key with `expo-cache-key`.
|
||||
You can opt-out from caching the Expo and EAS CLI installations.
|
||||
Under the hood, it uses the [`@actions/cache`][link-actions-cache-package] package to restore a previous install.
|
||||
It reduces the installation time because it only needs to download and extract a single tar file.
|
||||
|
||||
> Note, this cache will count towards your [repo cache limit][link-actions-cache-limit].
|
||||
> Note, using cache will count towards your [repo cache limit][link-actions-cache-limit]. Both the Expo and EAS CLI are stored in different caches.
|
||||
|
||||
### ENOSPC errors on Linux
|
||||
|
||||
When you run `expo publish` or `expo build`, a new bundle is created.
|
||||
Creating these bundles require quite some resources.
|
||||
As of writing, GitHub actions has some small default values for the `fs.inotify` settings.
|
||||
Inside this action, we included a patch that increases these limits for the current workflow.
|
||||
It increases the `max_user_instances`, `max_user_watches` and `max_queued_events` to `524288`.
|
||||
You can disable this patch by setting the `expo-patch-watchers` to `false`.
|
||||
Creating new bundles with Metro can be memory intensive.
|
||||
In the past, some builds resulted in `ENOSPC` errors.
|
||||
To prevent anyone from running into this, we make sure Ubuntu has sensible defaults in terms of file system availability.
|
||||
You can opt-out from patching the file system by setting **patch-watchers** to `false`.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
@@ -282,10 +208,9 @@ You can disable this patch by setting the `expo-patch-watchers` to `false`.
|
||||
|
||||
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
||||
[link-actions-cache-limit]: https://github.com/actions/cache#cache-limits
|
||||
[link-actions-cache-package]: https://www.npmjs.com/package/@actions/cache
|
||||
[link-actions-node]: https://github.com/actions/setup-node
|
||||
[link-actions-cache-package]: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||
[link-actions-secrets]: https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||
[link-expo-cli]: https://docs.expo.io/workflow/expo-cli/
|
||||
[link-expo-cli-password]: https://github.com/expo/expo-cli/blob/master/packages/expo-cli/src/accounts.ts#L88-L90
|
||||
[link-expo-release-channels]: https://docs.expo.io/distribution/release-channels/
|
||||
[link-semver-playground]: https://semver.npmjs.com/
|
||||
[link-expo-cli]: https://docs.expo.dev/workflow/expo-cli/
|
||||
[link-expo-release-channels]: https://docs.expo.dev/distribution/release-channels/
|
||||
[link-eas-cli]: https://github.com/expo/eas-cli#readme
|
||||
[link-preview-comment]: https://github.com/expo/expo-github-action/pull/149#issuecomment-1013184520
|
||||
+31
-20
@@ -1,31 +1,42 @@
|
||||
---
|
||||
name: Expo GitHub Action
|
||||
author: Cedric van Putten <[email protected]>
|
||||
description: Expo CLI in your GitHub Actions workflow.
|
||||
description: Publish, build or manage your Expo app with GitHub Actions
|
||||
branding:
|
||||
icon: terminal
|
||||
color: gray-dark
|
||||
runs:
|
||||
using: node12
|
||||
main: build/index.js
|
||||
using: node16
|
||||
main: build/setup/index.js
|
||||
inputs:
|
||||
expo-version:
|
||||
description: The Expo CLI version to install. (use any semver/dist-tag available)
|
||||
default: latest
|
||||
expo-username:
|
||||
description: Your Expo username, for authentication.
|
||||
expo-token:
|
||||
description: Your Expo token, for authentication. (use with secrets)
|
||||
expo-password:
|
||||
description: Your Expo password, for authentication. (use with secrets)
|
||||
expo-packager:
|
||||
description: The package manager used to install the Expo CLI. (can be yarn or npm)
|
||||
default: yarn
|
||||
expo-patch-watchers:
|
||||
description: If Expo should fix the default watchers limit, helps with ENOSPC errors. (can be true or false)
|
||||
default: true
|
||||
description: Expo CLI version to install
|
||||
expo-cache:
|
||||
description: If Expo should be stored in the GitHub Actions cache (can be true or false)
|
||||
default: false
|
||||
description: If Expo CLI should be cached to speed up installation
|
||||
default: true
|
||||
eas-version:
|
||||
description: EAS CLI version to install
|
||||
eas-cache:
|
||||
description: If EAS CLI should be cached to speed up installation
|
||||
default: true
|
||||
packager:
|
||||
description: The package manager used to install the CLIs
|
||||
default: yarn
|
||||
patch-watchers:
|
||||
description: If the action should patch the ENOSPC errors
|
||||
default: true
|
||||
token:
|
||||
description: Your Expo token, for authentication. (use with secrets)
|
||||
# Below are deprecated and won't be supported anymore
|
||||
eas-cache-key:
|
||||
description: A custom remote cache key to use for EAS CLI.
|
||||
deprecationMessage: Custom cache keys are deprecated and not used anymore.
|
||||
expo-cache-key:
|
||||
description: A custom remote cache key to use (best to let GitHub Actions handle it)
|
||||
description: A custom remote cache key to use for Expo CLI.
|
||||
deprecationMessage: Custom cache keys are deprecated and not used anymore.
|
||||
username:
|
||||
description: Your Expo username, for authentication.
|
||||
deprecationMessage: Username/password authentication is deprecated, use a token instead.
|
||||
password:
|
||||
description: Your Expo password, for authentication. (use with secrets)
|
||||
deprecationMessage: Username/password authentication is deprecated, use a token instead.
|
||||
@@ -1,24 +0,0 @@
|
||||
if (module !== require.main) {
|
||||
throw new Error("This file should not be loaded with require()")
|
||||
}
|
||||
|
||||
if (!process.getuid || !process.getgid) {
|
||||
throw new Error("this file should not be called without uid/gid support")
|
||||
}
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
, user = argv[0] || process.getuid()
|
||||
, group = argv[1] || process.getgid()
|
||||
|
||||
if (!isNaN(user)) user = +user
|
||||
if (!isNaN(group)) group = +group
|
||||
|
||||
console.error([user, group])
|
||||
|
||||
try {
|
||||
process.setgid(group)
|
||||
process.setuid(user)
|
||||
console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()}))
|
||||
} catch (ex) {
|
||||
console.log(JSON.stringify({error:ex.message,errno:ex.errno}))
|
||||
}
|
||||
-160107
File diff suppressed because it is too large.
Load diff
@@ -1,47 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const ls = require('../ls.js')
|
||||
const get = require('../get.js')
|
||||
const put = require('../put.js')
|
||||
const rm = require('../rm.js')
|
||||
const verify = require('../verify.js')
|
||||
const setLocale = require('../lib/util/y.js').setLocale
|
||||
const clearMemoized = require('../lib/memoization.js').clearMemoized
|
||||
const tmp = require('../lib/util/tmp.js')
|
||||
|
||||
setLocale('en')
|
||||
|
||||
const x = module.exports
|
||||
|
||||
x.ls = cache => ls(cache)
|
||||
x.ls.stream = cache => ls.stream(cache)
|
||||
|
||||
x.get = (cache, key, opts) => get(cache, key, opts)
|
||||
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
|
||||
x.get.sync = (cache, key, opts) => get.sync(cache, key, opts)
|
||||
x.get.sync.byDigest = (cache, key, opts) => get.sync.byDigest(cache, key, opts)
|
||||
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
|
||||
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
|
||||
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
|
||||
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
|
||||
x.get.info = (cache, key) => get.info(cache, key)
|
||||
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
|
||||
x.get.hasContent.sync = (cache, hash) => get.hasContent.sync(cache, hash)
|
||||
|
||||
x.put = (cache, key, data, opts) => put(cache, key, data, opts)
|
||||
x.put.stream = (cache, key, opts) => put.stream(cache, key, opts)
|
||||
|
||||
x.rm = (cache, key) => rm.entry(cache, key)
|
||||
x.rm.all = cache => rm.all(cache)
|
||||
x.rm.entry = x.rm
|
||||
x.rm.content = (cache, hash) => rm.content(cache, hash)
|
||||
|
||||
x.setLocale = lang => setLocale(lang)
|
||||
x.clearMemoized = () => clearMemoized()
|
||||
|
||||
x.tmp = {}
|
||||
x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts)
|
||||
x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb)
|
||||
|
||||
x.verify = (cache, opts) => verify(cache, opts)
|
||||
x.verify.lastRun = cache => verify.lastRun(cache)
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
|
||||
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
|
||||
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
|
||||
"Cache input stream was empty": "Cache input stream was empty",
|
||||
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const ls = require('../ls.js')
|
||||
const get = require('../get.js')
|
||||
const put = require('../put.js')
|
||||
const rm = require('../rm.js')
|
||||
const verify = require('../verify.js')
|
||||
const setLocale = require('../lib/util/y.js').setLocale
|
||||
const clearMemoized = require('../lib/memoization.js').clearMemoized
|
||||
const tmp = require('../lib/util/tmp.js')
|
||||
|
||||
setLocale('es')
|
||||
|
||||
const x = module.exports
|
||||
|
||||
x.ls = cache => ls(cache)
|
||||
x.ls.flujo = cache => ls.stream(cache)
|
||||
|
||||
x.saca = (cache, clave, ops) => get(cache, clave, ops)
|
||||
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
|
||||
x.saca.sinc = (cache, clave, ops) => get.sync(cache, clave, ops)
|
||||
x.saca.sinc.porHacheo = (cache, hacheo, ops) => get.sync.byDigest(cache, hacheo, ops)
|
||||
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
|
||||
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
|
||||
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
|
||||
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
|
||||
x.saca.info = (cache, clave) => get.info(cache, clave)
|
||||
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
|
||||
x.saca.tieneDatos.sinc = (cache, hacheo) => get.hasContent.sync(cache, hacheo)
|
||||
|
||||
x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops)
|
||||
x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops)
|
||||
|
||||
x.rm = (cache, clave) => rm.entry(cache, clave)
|
||||
x.rm.todo = cache => rm.all(cache)
|
||||
x.rm.entrada = x.rm
|
||||
x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo)
|
||||
|
||||
x.ponLenguaje = lang => setLocale(lang)
|
||||
x.limpiaMemoizado = () => clearMemoized()
|
||||
|
||||
x.tmp = {}
|
||||
x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops)
|
||||
x.tmp.hazdir = x.tmp.mkdir
|
||||
x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb)
|
||||
|
||||
x.verifica = (cache, ops) => verify(cache, ops)
|
||||
x.verifica.ultimaVez = cache => verify.lastRun(cache)
|
||||
x.verifica.últimaVez = x.verifica.ultimaVez
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»",
|
||||
"Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)",
|
||||
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s",
|
||||
"Cache input stream was empty": "El stream de entrada al caché estaba vacío"
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const ls = require('../ls.js')
|
||||
const get = require('../get.js')
|
||||
const put = require('../put.js')
|
||||
const rm = require('../rm.js')
|
||||
const verify = require('../verify.js')
|
||||
const setLocale = require('../lib/util/y.js').setLocale
|
||||
const clearMemoized = require('../lib/memoization.js').clearMemoized
|
||||
const tmp = require('../lib/util/tmp.js')
|
||||
|
||||
setLocale('en')
|
||||
|
||||
const x = module.exports
|
||||
|
||||
x.ls = cache => ls(cache)
|
||||
x.ls.stream = cache => ls.stream(cache)
|
||||
|
||||
x.get = (cache, key, opts) => get(cache, key, opts)
|
||||
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
|
||||
x.get.sync = (cache, key, opts) => get.sync(cache, key, opts)
|
||||
x.get.sync.byDigest = (cache, key, opts) => get.sync.byDigest(cache, key, opts)
|
||||
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
|
||||
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
|
||||
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
|
||||
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
|
||||
x.get.info = (cache, key) => get.info(cache, key)
|
||||
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
|
||||
x.get.hasContent.sync = (cache, hash) => get.hasContent.sync(cache, hash)
|
||||
|
||||
x.put = (cache, key, data, opts) => put(cache, key, data, opts)
|
||||
x.put.stream = (cache, key, opts) => put.stream(cache, key, opts)
|
||||
|
||||
x.rm = (cache, key) => rm.entry(cache, key)
|
||||
x.rm.all = cache => rm.all(cache)
|
||||
x.rm.entry = x.rm
|
||||
x.rm.content = (cache, hash) => rm.content(cache, hash)
|
||||
|
||||
x.setLocale = lang => setLocale(lang)
|
||||
x.clearMemoized = () => clearMemoized()
|
||||
|
||||
x.tmp = {}
|
||||
x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts)
|
||||
x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb)
|
||||
|
||||
x.verify = (cache, opts) => verify(cache, opts)
|
||||
x.verify.lastRun = cache => verify.lastRun(cache)
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
|
||||
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
|
||||
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
|
||||
"Cache input stream was empty": "Cache input stream was empty",
|
||||
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const ls = require('../ls.js')
|
||||
const get = require('../get.js')
|
||||
const put = require('../put.js')
|
||||
const rm = require('../rm.js')
|
||||
const verify = require('../verify.js')
|
||||
const setLocale = require('../lib/util/y.js').setLocale
|
||||
const clearMemoized = require('../lib/memoization.js').clearMemoized
|
||||
const tmp = require('../lib/util/tmp.js')
|
||||
|
||||
setLocale('es')
|
||||
|
||||
const x = module.exports
|
||||
|
||||
x.ls = cache => ls(cache)
|
||||
x.ls.flujo = cache => ls.stream(cache)
|
||||
|
||||
x.saca = (cache, clave, ops) => get(cache, clave, ops)
|
||||
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
|
||||
x.saca.sinc = (cache, clave, ops) => get.sync(cache, clave, ops)
|
||||
x.saca.sinc.porHacheo = (cache, hacheo, ops) => get.sync.byDigest(cache, hacheo, ops)
|
||||
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
|
||||
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
|
||||
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
|
||||
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
|
||||
x.saca.info = (cache, clave) => get.info(cache, clave)
|
||||
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
|
||||
x.saca.tieneDatos.sinc = (cache, hacheo) => get.hasContent.sync(cache, hacheo)
|
||||
|
||||
x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops)
|
||||
x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops)
|
||||
|
||||
x.rm = (cache, clave) => rm.entry(cache, clave)
|
||||
x.rm.todo = cache => rm.all(cache)
|
||||
x.rm.entrada = x.rm
|
||||
x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo)
|
||||
|
||||
x.ponLenguaje = lang => setLocale(lang)
|
||||
x.limpiaMemoizado = () => clearMemoized()
|
||||
|
||||
x.tmp = {}
|
||||
x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops)
|
||||
x.tmp.hazdir = x.tmp.mkdir
|
||||
x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb)
|
||||
|
||||
x.verifica = (cache, ops) => verify(cache, ops)
|
||||
x.verifica.ultimaVez = cache => verify.lastRun(cache)
|
||||
x.verifica.últimaVez = x.verifica.ultimaVez
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»",
|
||||
"Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)",
|
||||
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s",
|
||||
"Cache input stream was empty": "El stream de entrada al caché estaba vacío"
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,718 @@
|
||||
@actions/core
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/exec
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/github
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/http-client
|
||||
MIT
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@actions/io
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/tool-cache
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/core
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/endpoint
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/graphql
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/plugin-paginate-rest
|
||||
MIT
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/plugin-rest-endpoint-methods
|
||||
MIT
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/request
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/request-error
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
before-after-hook
|
||||
Apache-2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Gregor Martynus and other contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
deprecation
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Gregor Martynus and contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
encoding
|
||||
MIT
|
||||
Copyright (c) 2012-2014 Andris Reinman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
iconv-lite
|
||||
MIT
|
||||
Copyright (c) 2011 Alexander Shtuchkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
is-plain-object
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
node-fetch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Frank
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
once
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
safer-buffer
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Nikita Skovoroda <[email protected]>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
semver
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Koichi Kobayashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
uuid
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
wrappy
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+65267
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+9
-9
@@ -1,11 +1,11 @@
|
||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true,
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
const ncc = require('@vercel/ncc');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
build();
|
||||
|
||||
async function build() {
|
||||
const actionsDir = path.resolve(__dirname, 'src/actions');
|
||||
const buildDir = path.resolve(__dirname, 'build');
|
||||
|
||||
const actions = fs
|
||||
.readdirSync(actionsDir, { withFileTypes: true })
|
||||
.filter(entity => entity.isFile())
|
||||
.map(entity => ({
|
||||
name: path.basename(entity.name, path.extname(entity.name)),
|
||||
file: path.resolve(actionsDir, entity.name),
|
||||
}));
|
||||
|
||||
for (const action of actions) {
|
||||
const files = await compile(action.file);
|
||||
write(files, path.resolve(buildDir, action.name));
|
||||
|
||||
console.log(`✓ ${path.relative(__dirname, action.file)}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function compile(entry) {
|
||||
const { code, map, assets } = await ncc(entry, {
|
||||
cache: false,
|
||||
license: 'license.txt',
|
||||
quiet: true,
|
||||
});
|
||||
|
||||
return {
|
||||
...assets,
|
||||
'index.js': { source: code },
|
||||
'index.js.map': { source: map },
|
||||
};
|
||||
}
|
||||
|
||||
function write(files, dir) {
|
||||
for (const fileName in files) {
|
||||
if (!files[fileName].source) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const filePath = path.resolve(dir, fileName);
|
||||
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
fs.writeFileSync(filePath, files[fileName].source, { encoding: 'utf-8' });
|
||||
}
|
||||
}
|
||||
+49
-52
@@ -1,54 +1,51 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "expo-github-action",
|
||||
"version": "5.5.1",
|
||||
"description": "Expo CLI in your GitHub Actions workflow",
|
||||
"main": "build/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expo/expo-github-action.git"
|
||||
},
|
||||
"author": "Cedric van Putten <[email protected]>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expo/expo-github-action/issues"
|
||||
},
|
||||
"homepage": "https://github.com/expo/expo-github-action#readme",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"lint": "tsc --noEmit && eslint --ext ts ./src ./tests",
|
||||
"build": "ncc build src/index.ts --out build",
|
||||
"clean": "rimraf build",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^1.0.7",
|
||||
"@actions/core": "^1.4.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1",
|
||||
"libnpm": "^3.0.1",
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^5.0.1",
|
||||
"@semantic-release/git": "^9.0.0",
|
||||
"@tsconfig/node14": "^1.0.1",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^14.17.3",
|
||||
"@types/semver": "^7.3.6",
|
||||
"@typescript-eslint/eslint-plugin": "^4.27.0",
|
||||
"@typescript-eslint/parser": "^4.27.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"conventional-changelog-conventionalcommits": "^4.6.0",
|
||||
"eslint": "^7.28.0",
|
||||
"eslint-plugin-jest": "^24.3.6",
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^27.0.4",
|
||||
"jest-circus": "^27.0.4",
|
||||
"rimraf": "^3.0.2",
|
||||
"semantic-release": "^17.4.4",
|
||||
"ts-jest": "^27.0.3",
|
||||
"typescript": "^4.3.3"
|
||||
}
|
||||
"private": true,
|
||||
"name": "expo-github-action",
|
||||
"version": "7.0.1",
|
||||
"description": "Expo CLI in your GitHub Actions workflow",
|
||||
"main": "build/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expo/expo-github-action.git"
|
||||
},
|
||||
"author": "Cedric van Putten <[email protected]>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expo/expo-github-action/issues"
|
||||
},
|
||||
"homepage": "https://github.com/expo/expo-github-action#readme",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"lint": "eslint .",
|
||||
"build": "node ncc.js",
|
||||
"clean": "rimraf build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^1.0.8",
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^16.11.19",
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||
"@typescript-eslint/parser": "^5.9.1",
|
||||
"@vercel/ncc": "^0.33.1",
|
||||
"conventional-changelog-conventionalcommits": "^4.6.3",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-universe": "^10.0.0",
|
||||
"jest": "^27.4.7",
|
||||
"prettier": "^2.5.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"semantic-release": "^18.0.1",
|
||||
"ts-jest": "^27.1.2",
|
||||
"typescript": "^4.5.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<div align="center">
|
||||
<h1>expo-github-action/preview-comment</h1>
|
||||
<p>Add <a href="https://github.com/expo/expo">Expo</a> preview comments to pull requests</p>
|
||||
<p>
|
||||
<a href="https://github.com/expo/expo-github-action/releases">
|
||||
<img src="https://img.shields.io/github/v/release/expo/expo-github-action" alt="releases" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/actions">
|
||||
<img src="https://img.shields.io/github/workflow/status/expo/expo-github-action/test" alt="builds" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/LICENSE.md">
|
||||
<img src="https://img.shields.io/github/license/expo/expo-github-action" alt="license" />
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="#configuration-options"><b>Usage</b></a>
|
||||
—
|
||||
<a href="#available-outputs"><b>Outputs</b></a>
|
||||
—
|
||||
<a href="#example-workflows"><b>Examples</b></a>
|
||||
—
|
||||
<a href="#things-to-know"><b>Caveats</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/CHANGELOG.md"><b>Changelog</b></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## What's inside?
|
||||
|
||||
This (sub)action allows you to comment on pull requests containing Expo QR codes.
|
||||
It can help speed up the review process by letting the reviewer load the app directly on their phone.
|
||||
|
||||
> This action only creates the comment. You still have to publish the project.
|
||||
|
||||
## Configuration options
|
||||
|
||||
This action is customizable through variables defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the input options you can use.
|
||||
|
||||
| variable | default | description |
|
||||
| -------------- | --------------------------- | ------------------------------------------------------------------------------------------------ |
|
||||
| **project** | - | The relative path to the Expo project |
|
||||
| **channel** | `default` | On what channel the project was published |
|
||||
| **comment** | `true` | If this action should comment on a PR |
|
||||
| **message** | _[see code][code-defaults]_ | The message template |
|
||||
| **message-id** | _[see code][code-defaults]_ | A unique id template to prevent duplicate comments ([read more](#preventing-duplicate-comments)) |
|
||||
|
||||
## Available outputs
|
||||
|
||||
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 |
|
||||
|
||||
## Example workflows
|
||||
|
||||
Before diving into the workflow examples, you should know the basics of GitHub Actions.
|
||||
You can read more about this in the [GitHub Actions documentation][link-actions].
|
||||
|
||||
1. [Publish and preview on pull request](#publish-and-preview-on-pull-request)
|
||||
2. [Sending preview comments elsewhere](#sending-preview-comments-elsewhere)
|
||||
|
||||
### Publish and preview on pull request
|
||||
|
||||
This workflow listens to the `pull_request` event and publishes a to Expo, on release channel `pr-#`.
|
||||
Once that's done, it will comment with the QR code on that same pull request.
|
||||
It's essential to keep pull requests separated, by release channel, to avoid writing over pull requests.
|
||||
|
||||
```yml
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: expo/expo-github-action@v7
|
||||
with:
|
||||
expo-version: 5.x
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: 🚀 Publish to Expo
|
||||
run: expo publish --release-channel=pr-${{ github.event.number }} --non-interactive
|
||||
|
||||
- name: 💬 Comment in preview
|
||||
uses: expo/expo-github-action/preview-comment@v7
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
channel: pr-${{ github.event.number }}
|
||||
```
|
||||
|
||||
### Sending preview comments elsewhere
|
||||
|
||||
You can also use this action to generate the comment without actually commenting.
|
||||
By disabling commenting with **comment** set to `false`, you can reuse this action with any workflow trigger and send it to any service accessible in GitHub Actions.
|
||||
|
||||
> See [Available variables](#available-variables) for a list of all outputs.
|
||||
|
||||
```yml
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: expo/expo-github-action@v7
|
||||
with:
|
||||
expo-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: 🚀 Publish preview
|
||||
run: expo publish --release-channel=production --non-interactive
|
||||
|
||||
- name: 👷 Create preview comment
|
||||
uses: expo/expo-github-action/preview-comment@v7
|
||||
id: preview
|
||||
with:
|
||||
comment: false
|
||||
channel: production
|
||||
|
||||
- name: 💬 Comment in Slack
|
||||
uses: slackapi/[email protected]
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
|
||||
with:
|
||||
channel-id: deployments
|
||||
slack-message: 'New deployment is ready!\n- Preview: ${{ steps.preview.outputs.projectQR }}'
|
||||
```
|
||||
|
||||
## Things to know
|
||||
|
||||
### Preventing duplicate comments
|
||||
|
||||
When automating these preview comments, you have to be careful not to spam a pull request on every successful run.
|
||||
Every comment contains a generated **message-id** to identify previously made comments and update instead of creating a new comment.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <strong>byCedric</strong>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
[code-defaults]: ../src/actions/preview-comment.ts
|
||||
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: Expo GitHub Action - Preview comment
|
||||
author: Cedric van Putten <[email protected]>
|
||||
description: Add Expo preview comments to pull requests
|
||||
branding:
|
||||
icon: message-circle
|
||||
color: gray-dark
|
||||
runs:
|
||||
using: node16
|
||||
main: ../build/preview-comment/index.js
|
||||
inputs:
|
||||
project:
|
||||
description: Path to the Expo project, relative from the workspace
|
||||
required: false
|
||||
channel:
|
||||
description: Release channel to preview
|
||||
required: false
|
||||
comment:
|
||||
description: If the action should comment on a PR
|
||||
required: false
|
||||
default: true
|
||||
message:
|
||||
description: Pull request comment template
|
||||
required: false
|
||||
message-id:
|
||||
description: A unique identifier to prevent multiple comments on the same pull request
|
||||
required: false
|
||||
outputs:
|
||||
projectOwner:
|
||||
description: The resolved project owner
|
||||
projectName:
|
||||
description: The resolved project name
|
||||
projectSlug:
|
||||
description: The resolved project slug
|
||||
projectQR:
|
||||
description: The absolute URL to the QR code
|
||||
projectLink:
|
||||
description: The absolute link to the project on expo.dev
|
||||
messageId:
|
||||
description: The resolved message id
|
||||
message:
|
||||
description: The resolved message content
|
||||
@@ -0,0 +1,69 @@
|
||||
import { getBooleanInput, getInput, setOutput, info } from '@actions/core';
|
||||
|
||||
import { projectInfo, projectLink, projectOwner, projectQR } from '../expo';
|
||||
import { createIssueComment, pullContext } from '../github';
|
||||
import { executeAction } from '../worker';
|
||||
|
||||
export type CommentInput = ReturnType<typeof commentInput>;
|
||||
|
||||
export const DEFAULT_ID = `app:@{projectOwner}/{projectSlug} channel:{channel}`;
|
||||
export const DEFAULT_MESSAGE =
|
||||
`This pull request was automatically deployed using [Expo GitHub Actions](https://github.com/expo/expo-github-action/tree/main/preview-comment)!\n` +
|
||||
`\n- Project: **@{projectOwner}/{projectSlug}**` +
|
||||
`\n- Channel: **{channel}**` +
|
||||
`\n\n<a href="{projectQR}"><img src="{projectQR}" height="200px" width="200px"></a>`;
|
||||
|
||||
export function commentInput() {
|
||||
return {
|
||||
channel: getInput('channel') || 'default',
|
||||
comment: !getInput('comment') || getBooleanInput('comment'),
|
||||
message: getInput('message') || DEFAULT_MESSAGE,
|
||||
messageId: getInput('message-id') || DEFAULT_ID,
|
||||
project: getInput('project'),
|
||||
};
|
||||
}
|
||||
|
||||
executeAction(commentAction);
|
||||
|
||||
export async function commentAction(input: CommentInput = commentInput()) {
|
||||
const project = await projectInfo(input.project);
|
||||
if (!project.owner) {
|
||||
project.owner = await projectOwner();
|
||||
}
|
||||
|
||||
const variables: Record<string, string> = {
|
||||
projectLink: projectLink(project, input.channel),
|
||||
projectName: project.name,
|
||||
projectOwner: project.owner || '',
|
||||
projectQR: projectQR(project, input.channel),
|
||||
projectSlug: project.slug,
|
||||
channel: input.channel,
|
||||
};
|
||||
|
||||
const messageId = template(input.messageId, variables);
|
||||
const messageBody = template(input.message, variables);
|
||||
|
||||
if (!input.comment) {
|
||||
info(`Skipped comment: 'comment' is disabled`);
|
||||
} else {
|
||||
await createIssueComment(pullContext(), {
|
||||
id: messageId,
|
||||
body: messageBody,
|
||||
});
|
||||
}
|
||||
|
||||
for (const name in variables) {
|
||||
setOutput(name, variables[name]);
|
||||
}
|
||||
|
||||
setOutput('messageId', messageId);
|
||||
setOutput('message', messageBody);
|
||||
}
|
||||
|
||||
function template(template: string, replacements: Record<string, string>) {
|
||||
let result = template;
|
||||
for (const name in replacements) {
|
||||
result = result.replaceAll(`{${name}}`, replacements[name]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import { getBooleanInput, getInput, group, info } from '@actions/core';
|
||||
|
||||
import { restoreFromCache, saveToCache } from '../cacher';
|
||||
import { authenticate } from '../expo';
|
||||
import { installPackage, resolvePackage } from '../packager';
|
||||
import { executeAction, findTool, installToolFromPackage, patchWatchers } from '../worker';
|
||||
|
||||
export type SetupInput = ReturnType<typeof setupInput>;
|
||||
|
||||
export function setupInput() {
|
||||
return {
|
||||
easCache: !getInput('eas-cache') || getBooleanInput('eas-cache'),
|
||||
easVersion: getInput('eas-version'),
|
||||
expoCache: !getInput('expo-cache') || getBooleanInput('expo-cache'),
|
||||
expoVersion: getInput('expo-version'),
|
||||
packager: getInput('packager') || 'yarn',
|
||||
patchWatchers: !getInput('patch-watchers') || getBooleanInput('patch-watchers'),
|
||||
token: getInput('token'),
|
||||
};
|
||||
}
|
||||
|
||||
executeAction(setupAction);
|
||||
|
||||
export async function setupAction(input: SetupInput = setupInput()) {
|
||||
if (!input.expoVersion) {
|
||||
info(`Skipped installing expo-cli: 'expo-version' not provided.`);
|
||||
} else {
|
||||
const version = await resolvePackage('expo-cli', input.expoVersion);
|
||||
const message = input.expoCache
|
||||
? `Installing expo-cli (${version}) from cache or with ${input.packager}`
|
||||
: `Installing expo-cli (${version}) with ${input.packager}`;
|
||||
|
||||
await group(message, () => installCli('expo-cli', version, input.packager, input.expoCache));
|
||||
}
|
||||
|
||||
if (!input.easVersion) {
|
||||
info(`Skipped installing eas-cli: 'eas-version' not provided.`);
|
||||
} else {
|
||||
const version = await resolvePackage('eas-cli', input.easVersion);
|
||||
const message = input.easCache
|
||||
? `Installing eas-cli (${version}) from cache or with ${input.packager}`
|
||||
: `Installing eas-cli (${version}) with ${input.packager}`;
|
||||
|
||||
await group(message, () => installCli('eas-cli', version, input.packager, input.easCache));
|
||||
}
|
||||
|
||||
if (!input.token) {
|
||||
info(`Skipped authentication: 'token' not provided.`);
|
||||
} else {
|
||||
await group('Validating authenticated account', () =>
|
||||
authenticate(input.token, input.easVersion ? 'eas' : input.expoVersion ? 'expo' : undefined)
|
||||
);
|
||||
}
|
||||
|
||||
if (!input.patchWatchers) {
|
||||
info(`Skipped patching watchers: 'patch-watchers' disabled.`);
|
||||
} else {
|
||||
await group(`Patching system watchers for the 'ENOSPC' error`, patchWatchers);
|
||||
}
|
||||
}
|
||||
|
||||
async function installCli(name: string, version: string, packager: string, useCache = true) {
|
||||
let cliPath = findTool(name, version) || undefined;
|
||||
|
||||
if (!cliPath && useCache) {
|
||||
cliPath = await restoreFromCache(name, version, packager);
|
||||
}
|
||||
|
||||
if (!cliPath) {
|
||||
cliPath = await installPackage(name, version, packager);
|
||||
|
||||
if (useCache) {
|
||||
await saveToCache(name, version, packager);
|
||||
}
|
||||
}
|
||||
|
||||
installToolFromPackage(cliPath);
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
import { ReserveCacheError, restoreCache, saveCache } from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as toolCache from '@actions/tool-cache';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
|
||||
/**
|
||||
* Get the path to the `expo-cli` from cache, if any.
|
||||
* Note, this cache is **NOT** shared between jobs.
|
||||
*
|
||||
* @see https://github.com/actions/toolkit/issues/47
|
||||
*/
|
||||
export async function fromLocalCache(version: string): Promise<string | undefined> {
|
||||
return toolCache.find('expo-cli', version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the root of `expo-cli` in the cache, for future reuse.
|
||||
* Note, this cache is **NOT** shared between jobs.
|
||||
*
|
||||
* @see https://github.com/actions/toolkit/issues/47
|
||||
*/
|
||||
export async function toLocalCache(root: string, version: string): Promise<string> {
|
||||
return toolCache.cacheDir(root, 'expo-cli', version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the remotely stored `expo-cli` from cache, if any.
|
||||
* Note, this cache is shared between jobs.
|
||||
*/
|
||||
export async function fromRemoteCache(version: string, packager: string, customCacheKey?: string): Promise<string | undefined> {
|
||||
// see: https://github.com/actions/toolkit/blob/8a4134761f09d0d97fb15f297705fd8644fef920/packages/tool-cache/src/tool-cache.ts#L401
|
||||
const target = path.join(process.env['RUNNER_TOOL_CACHE'] || '', 'expo-cli', version, os.arch());
|
||||
const cacheKey = customCacheKey || getRemoteKey(version, packager);
|
||||
|
||||
try {
|
||||
// When running with nektos/act, or other custom environments, the cache might not be set up.
|
||||
const hit = await restoreCache([target], cacheKey);
|
||||
if (hit) {
|
||||
return target;
|
||||
}
|
||||
} catch (error) {
|
||||
if (!handleRemoteCacheError(error)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the root of `expo-cli` in the remote cache, for future reuse.
|
||||
* Note, this cache is shared between jobs.
|
||||
*/
|
||||
export async function toRemoteCache(source: string, version: string, packager: string, customCacheKey?: string): Promise<void> {
|
||||
const cacheKey = customCacheKey || getRemoteKey(version, packager);
|
||||
|
||||
try {
|
||||
await saveCache([source], cacheKey);
|
||||
} catch (error) {
|
||||
if (!handleRemoteCacheError(error)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cache key to use when (re)storing the Expo CLI from remote cache.
|
||||
*/
|
||||
function getRemoteKey(version: string, packager: string): string {
|
||||
return `expo-cli-${process.platform}-${os.arch()}-${packager}-${version}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle any incoming errors from cache methods.
|
||||
* This can include actual errors like `ReserveCacheErrors` or unavailability errors.
|
||||
* When the error is handled, it MUST provide feedback for the developer.
|
||||
*
|
||||
* @returns If the error was handled properly.
|
||||
*/
|
||||
function handleRemoteCacheError(error: Error): boolean {
|
||||
const isReserveCacheError = error instanceof ReserveCacheError;
|
||||
const isCacheUnavailable = error.message.toLowerCase().includes(
|
||||
'cache service url not found',
|
||||
);
|
||||
|
||||
if (isReserveCacheError || isCacheUnavailable) {
|
||||
core.warning('Skipping remote cache storage, encountered error:');
|
||||
core.warning(error.message);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { saveCache, restoreCache, ReserveCacheError } from '@actions/cache';
|
||||
import { warning } from '@actions/core';
|
||||
import os from 'os';
|
||||
|
||||
import { toolPath } from './worker';
|
||||
|
||||
/**
|
||||
* Get the exact cache key for the package.
|
||||
* We can prefix this when there are breaking changes in this action.
|
||||
*/
|
||||
export function cacheKey(name: string, version: string, manager: string): string {
|
||||
return `${name}-${process.platform}-${os.arch()}-${manager}-${version}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a tool from the remote cache.
|
||||
* This will install the tool back into the local tool cache.
|
||||
*/
|
||||
export async function restoreFromCache(name: string, version: string, manager: string) {
|
||||
const dir = toolPath(name, version)!;
|
||||
try {
|
||||
if (await restoreCache([dir], cacheKey(name, version, manager))) {
|
||||
return dir;
|
||||
}
|
||||
} catch (error) {
|
||||
handleCacheError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a tool to the remote cache.
|
||||
* This will fetch the tool from the local tool cache.
|
||||
*/
|
||||
export async function saveToCache(name: string, version: string, manager: string) {
|
||||
try {
|
||||
await saveCache([toolPath(name, version)], cacheKey(name, version, manager));
|
||||
} catch (error) {
|
||||
handleCacheError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to handle incoming cache errors.
|
||||
* Because workers can operate in environments without cache configured,
|
||||
* we need to make sure to only skip the cache instead of fail.
|
||||
*
|
||||
* Currently we handle these types of errors:
|
||||
* - ReserveCacheError
|
||||
* - "cache service url not found"
|
||||
*/
|
||||
export function handleCacheError(error: Error): void {
|
||||
const isReserveCacheError = error instanceof ReserveCacheError;
|
||||
const isCacheUnavailable = error.message.toLowerCase().includes('cache service url not found');
|
||||
|
||||
if (isReserveCacheError || isCacheUnavailable) {
|
||||
warning('Skipped remote cache, encountered error:');
|
||||
warning(error.message);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
import { info, exportVariable } from '@actions/core';
|
||||
import { exec, getExecOutput } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
import { ok as assert } from 'assert';
|
||||
import { URL } from 'url';
|
||||
|
||||
export type CliName = 'expo' | 'eas';
|
||||
|
||||
export interface ProjectInfo {
|
||||
name: string;
|
||||
slug: string;
|
||||
owner?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to authenticate the user using either Expo or EAS CLI.
|
||||
* This method tries to invoke 'whoami' to validate if the token is valid.
|
||||
* If that passes, the token is exported as EXPO_TOKEN for all steps within the job.
|
||||
*/
|
||||
export async function authenticate(token: string, cli: CliName = 'expo'): Promise<void> {
|
||||
if (!cli) {
|
||||
info(`Skipped token validation: no CLI installed, can't run 'whoami'.`);
|
||||
} else {
|
||||
await exec(await which(cli), ['whoami'], {
|
||||
env: { ...process.env, EXPO_TOKEN: token },
|
||||
});
|
||||
}
|
||||
|
||||
exportVariable('EXPO_TOKEN', token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to resolve the project owner, by running 'eas|expo whoami'.
|
||||
*/
|
||||
export async function projectOwner(cli: CliName = 'expo'): Promise<string> {
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput(await which(cli), ['whoami'], { silent: true }));
|
||||
} catch (error) {
|
||||
throw new Error(`Could not fetch the project owner, reason:\n${error.message | error}`);
|
||||
}
|
||||
|
||||
if (!stdout) {
|
||||
throw new Error(`Could not fetch the project owner, not authenticated`);
|
||||
} else if (stdout.endsWith(' (robot)')) {
|
||||
throw new Error(`Could not fetch the project owner, used robot account`);
|
||||
}
|
||||
|
||||
return stdout.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to resolve the project info, by running 'expo config --type prebuild'.
|
||||
*/
|
||||
export async function projectInfo(dir: string): Promise<ProjectInfo> {
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput(await which('expo', true), ['config', '--json', '--type', 'prebuild'], {
|
||||
cwd: dir,
|
||||
silent: true,
|
||||
}));
|
||||
} catch (error) {
|
||||
throw new Error(`Could not fetch the project info from ${dir}, reason:\n${error.message || error}`);
|
||||
}
|
||||
|
||||
const { name, slug, owner } = JSON.parse(stdout);
|
||||
return { name, slug, owner };
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a QR code for an update on project, with an optional release channel.
|
||||
*/
|
||||
export function projectQR(project: ProjectInfo, channel?: string): string {
|
||||
assert(project.owner, 'Could not create a QR code for project without owner');
|
||||
|
||||
const url = new URL('https://qr.expo.dev/expo-go');
|
||||
url.searchParams.append('owner', project.owner);
|
||||
url.searchParams.append('slug', project.slug);
|
||||
if (channel) {
|
||||
url.searchParams.append('releaseChannel', channel);
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a link for the project in Expo.
|
||||
*/
|
||||
export function projectLink(project: ProjectInfo, channel?: string): string {
|
||||
assert(project.owner, 'Could not create a QR code for project without owner');
|
||||
|
||||
const url = new URL(`https://expo.dev/@${project.owner}/${project.slug}`);
|
||||
if (channel) {
|
||||
url.searchParams.append('release-channel', channel);
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { getOctokit, context } from '@actions/github';
|
||||
import { ok as assert } from 'assert';
|
||||
|
||||
type IssueContext = typeof context['issue'];
|
||||
|
||||
type Comment = {
|
||||
/** A hidden identifier to embed in the comment */
|
||||
id: string;
|
||||
/** The contents of the comment */
|
||||
body: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a comment exists on an issue or pull with the provided identifier.
|
||||
* This will iterate all comments received from GitHub, and try to exit early if it exists.
|
||||
*/
|
||||
export async function fetchIssueComment(issue: IssueContext, commentId: Comment['id']) {
|
||||
const github = githubApi();
|
||||
const iterator = github.paginate.iterator(github.rest.issues.listComments, {
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
issue_number: issue.number,
|
||||
});
|
||||
|
||||
for await (const { data: batch } of iterator) {
|
||||
for (const item of batch) {
|
||||
if ((item.body || '').includes(commentId)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new comment on an existing issue or pull.
|
||||
* This includes a hidden identifier (markdown comment) to identify the comment later.
|
||||
* It will also update the comment when a previous comment id was found.
|
||||
*/
|
||||
export async function createIssueComment(issue: IssueContext, comment: Comment) {
|
||||
const github = githubApi();
|
||||
const body = `<!-- ${comment.id} -->\n${comment.body}`;
|
||||
const existing = await fetchIssueComment(issue, comment.id);
|
||||
|
||||
if (existing) {
|
||||
return github.rest.issues.updateComment({
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
comment_id: existing.id,
|
||||
body,
|
||||
});
|
||||
}
|
||||
|
||||
return github.rest.issues.createComment({
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
issue_number: issue.number,
|
||||
body,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an authenticated octokit instance.
|
||||
* This uses the 'GITHUB_TOKEN' environment variable.
|
||||
*/
|
||||
export function githubApi(): ReturnType<typeof getOctokit> {
|
||||
assert(process.env['GITHUB_TOKEN'], 'This step requires a GITHUB_TOKEN environment variable to create comments');
|
||||
return getOctokit(process.env['GITHUB_TOKEN']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and extract the pull reference from context.
|
||||
* If it's not a supported event, e.g. not a pull, it will throw an error.
|
||||
* Unfortunately, we can't overwrite the GitHub event details, it includes some testing code.
|
||||
*/
|
||||
export function pullContext(): IssueContext {
|
||||
// see .github/workflows/test.yml in 'comment'
|
||||
if (process.env['EXPO_TEST_GITHUB_PULL']) {
|
||||
return { ...context.repo, number: Number(process.env['EXPO_TEST_GITHUB_PULL']) };
|
||||
}
|
||||
|
||||
assert(
|
||||
context.eventName === 'pull_request',
|
||||
'Could not find the pull request context, make sure to run this from a pull_request triggered workflow'
|
||||
);
|
||||
return context.issue;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { run } from './run';
|
||||
import { handleError } from './tools';
|
||||
|
||||
run().catch(handleError);
|
||||
@@ -1,53 +0,0 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as cli from '@actions/exec';
|
||||
import * as io from '@actions/io';
|
||||
import * as path from 'path';
|
||||
|
||||
import { fromLocalCache, fromRemoteCache, toLocalCache, toRemoteCache } from './cache';
|
||||
|
||||
export type InstallConfig = {
|
||||
version: string;
|
||||
packager: string;
|
||||
cache?: boolean;
|
||||
cacheKey?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Install `expo-cli`, by version, using the packager.
|
||||
* Here you can provide any semver range or dist tag used in the registry.
|
||||
* It returns the path where Expo is installed.
|
||||
*/
|
||||
export async function install(config: InstallConfig): Promise<string> {
|
||||
let root: string | undefined = await fromLocalCache(config.version);
|
||||
|
||||
if (!root && config.cache) {
|
||||
root = await fromRemoteCache(config.version, config.packager, config.cacheKey);
|
||||
} else {
|
||||
core.info('Skipping remote cache, not enabled...');
|
||||
}
|
||||
|
||||
if (!root) {
|
||||
root = await fromPackager(config.version, config.packager);
|
||||
root = await toLocalCache(root, config.version);
|
||||
|
||||
if (config.cache) {
|
||||
await toRemoteCache(root, config.version, config.packager, config.cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
return path.join(root, 'node_modules', '.bin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Install `expo-cli`, by version, using npm or yarn.
|
||||
* It creates a temporary directory to store all required files.
|
||||
*/
|
||||
export async function fromPackager(version: string, packager: string): Promise<string> {
|
||||
const root = process.env['RUNNER_TEMP'] || '';
|
||||
const tool = await io.which(packager);
|
||||
|
||||
await io.mkdirP(root);
|
||||
await cli.exec(tool, ['add', `expo-cli@${version}`], { cwd: root });
|
||||
|
||||
return root;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { exec, getExecOutput } from '@actions/exec';
|
||||
import { which, mkdirP } from '@actions/io';
|
||||
|
||||
import { cacheTool, tempPath } from './worker';
|
||||
|
||||
/**
|
||||
* Resolve a package with version range to an exact version.
|
||||
* This is useful to invalidate the cache _and_ using dist-tags or version ranges.
|
||||
* It executes `npm info` and parses the latest manifest.
|
||||
*/
|
||||
export async function resolvePackage(name: string, range: string): Promise<string> {
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
} catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}, reason:\n${error.message || error}`);
|
||||
}
|
||||
|
||||
// thanks npm, for returning a "x.x.x" json value...
|
||||
if (stdout.startsWith('"')) {
|
||||
stdout = `[${stdout}]`;
|
||||
}
|
||||
|
||||
return JSON.parse(stdout).at(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install a module using a node package manager.
|
||||
* The installation is executed in a temporary folder.
|
||||
* After this is complete, it's "installed" into the worker's tool cache.
|
||||
*/
|
||||
export async function installPackage(name: string, version: string, manager: string) {
|
||||
const temp = tempPath(name, version);
|
||||
const tool = await which(manager);
|
||||
|
||||
await mkdirP(temp);
|
||||
await exec(tool, ['add', `${name}@${version}`], { cwd: temp });
|
||||
|
||||
return cacheTool(temp, name, version);
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
import { addPath, getInput, group } from '@actions/core';
|
||||
|
||||
import { install, InstallConfig } from './install';
|
||||
import { maybeAuthenticate, maybePatchWatchers, resolveVersion } from './tools';
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
const config: InstallConfig = {
|
||||
version: getInput('expo-version') || 'latest',
|
||||
packager: getInput('expo-packager') || 'yarn',
|
||||
cache: (getInput('expo-cache') || 'false') === 'true',
|
||||
cacheKey: getInput('expo-cache-key') || undefined,
|
||||
};
|
||||
|
||||
// Resolve the exact requested Expo CLI version
|
||||
config.version = await resolveVersion(config.version);
|
||||
|
||||
const path = await group(
|
||||
config.cache
|
||||
? `Installing Expo CLI (${config.version}) from cache or with ${config.packager}`
|
||||
: `Installing Expo CLI (${config.version}) with ${config.packager}`,
|
||||
() => install(config),
|
||||
);
|
||||
|
||||
addPath(path);
|
||||
|
||||
await group(
|
||||
'Checking current authenticated account',
|
||||
() => maybeAuthenticate({
|
||||
token: getInput('expo-token') || undefined,
|
||||
username: getInput('expo-username') || undefined,
|
||||
password: getInput('expo-password') || undefined,
|
||||
}),
|
||||
);
|
||||
|
||||
const shouldPatchWatchers = getInput('expo-patch-watchers') || 'true';
|
||||
|
||||
if (shouldPatchWatchers !== 'false') {
|
||||
await group(
|
||||
'Patching system watchers for the `ENOSPC` error',
|
||||
() => maybePatchWatchers(),
|
||||
);
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as cli from '@actions/exec';
|
||||
import semver from 'semver';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const registry = require('libnpm');
|
||||
|
||||
type AuthenticateOptions = {
|
||||
token?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolve the provided semver to exact version of `expo-cli`.
|
||||
* This uses the npm registry and accepts latest, dist-tags or version ranges.
|
||||
* It's used to determine the cached version of `expo-cli`.
|
||||
*/
|
||||
export async function resolveVersion(version: string): Promise<string> {
|
||||
return (await registry.manifest(`expo-cli@${version}`)).version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with Expo using either the token or username/password method.
|
||||
* If both of them are set, token has priority.
|
||||
*/
|
||||
export async function maybeAuthenticate(options: AuthenticateOptions = {}): Promise<void> {
|
||||
// github actions toolkit will handle commands with `.cmd` on windows, we need that
|
||||
const bin = process.platform === 'win32' ? 'expo.cmd' : 'expo';
|
||||
|
||||
if (options.token) {
|
||||
await cli.exec(bin, ['whoami'], {
|
||||
env: { ...process.env, EXPO_TOKEN: options.token },
|
||||
});
|
||||
return core.exportVariable('EXPO_TOKEN', options.token);
|
||||
}
|
||||
|
||||
if (options.username || options.password) {
|
||||
if (!options.username || !options.password) {
|
||||
return core.info('Skipping authentication: `expo-username` and/or `expo-password` not set...');
|
||||
}
|
||||
await cli.exec(bin, ['login', `--username=${options.username}`], {
|
||||
env: { ...process.env, EXPO_CLI_PASSWORD: options.password },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
core.info('Skipping authentication: `expo-token`, `expo-username`, and/or `expo-password` not set...');
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to patch the default watcher/inotify limit.
|
||||
* This is a limitation from GitHub Actions and might be an issue in some Expo projects.
|
||||
* It sets the system's `fs.inotify` limits to a more sensible setting.
|
||||
*
|
||||
* @see https://github.com/expo/expo-github-action/issues/20
|
||||
*/
|
||||
export async function maybePatchWatchers(): Promise<void> {
|
||||
if (process.platform !== 'linux') {
|
||||
return core.info('Skipping patch for watchers, not running on Linux...');
|
||||
}
|
||||
|
||||
core.info('Patching system watchers for the `ENOSPC` error...');
|
||||
|
||||
try {
|
||||
// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
|
||||
await cli.exec('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
await cli.exec('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
await cli.exec('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
await cli.exec('sudo sysctl -p');
|
||||
} catch {
|
||||
core.warning("Looks like we can't patch watchers/inotify limits, you might encouter the `ENOSPC` error.");
|
||||
core.warning('For more info, https://github.com/expo/expo-github-action/issues/20');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is a new major version available.
|
||||
* If there is, create a warning for people to upgrade their workflow.
|
||||
* Because this introduces additional requests, it should only be executed when necessary.
|
||||
*/
|
||||
export async function maybeWarnForUpdate(): Promise<void> {
|
||||
const latest = await resolveVersion('latest');
|
||||
const current = await resolveVersion(core.getInput('expo-version') || 'latest');
|
||||
|
||||
if (semver.diff(latest, current) === 'major') {
|
||||
core.warning(`There is a new major version available of the Expo CLI (${latest})`);
|
||||
core.warning(`If you run into issues, try upgrading your workflow to "expo-version: ${semver.major(latest)}.x"`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle errors when this action fails, providing useful next-steps for developers.
|
||||
* This mostly checks if the installed version is the latest version.
|
||||
*/
|
||||
export async function handleError(error: Error) {
|
||||
try {
|
||||
await maybeWarnForUpdate();
|
||||
} catch {
|
||||
// If this fails, ignore it
|
||||
}
|
||||
|
||||
core.setFailed(error);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { addPath, info, setFailed, warning } from '@actions/core';
|
||||
import { exec } from '@actions/exec';
|
||||
import { ok as assert } from 'assert';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
export { find as findTool, cacheDir as cacheTool } from '@actions/tool-cache';
|
||||
|
||||
/**
|
||||
* Auto-execute the action and pass errors to 'core.setFailed'.
|
||||
*/
|
||||
export async function executeAction(action: () => Promise<void>) {
|
||||
return action().catch(error => setFailed(error.message || error));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install a "tool" from a node package.
|
||||
* This will add the folder, containing the `node_modules`, to the global path.
|
||||
*/
|
||||
export function installToolFromPackage(dir: string) {
|
||||
return addPath(path.join(dir, 'node_modules', '.bin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to patch Linux's inotify limits to a more sensible setting on Linux.
|
||||
* This limitation could cause `ENOSPC` errors when bundling Expo or React Native projects.
|
||||
*
|
||||
* It will try to change these `fs.inotify.` limits:
|
||||
* - .max_user_instances = 524288
|
||||
* - .max_user_watches = 524288
|
||||
* - .max_queued_events = 524288
|
||||
*
|
||||
* @see https://github.com/expo/expo-github-action/issues/20
|
||||
*/
|
||||
export async function patchWatchers(): Promise<void> {
|
||||
if (process.platform !== 'linux') {
|
||||
return info('Skipped patching watchers: not running on Linux.');
|
||||
}
|
||||
|
||||
try {
|
||||
// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
|
||||
await exec('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
await exec('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
await exec('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
await exec('sudo sysctl -p');
|
||||
info('Patched system watchers for the `ENOSPC` error.');
|
||||
} catch (error) {
|
||||
warning(`Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`);
|
||||
warning('For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:');
|
||||
warning(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
export function tempPath(name: string, version: string): string {
|
||||
assert(process.env['RUNNER_TEMP'], 'Could not resolve temporary path, RUNNER_TEMP not defined');
|
||||
return path.join(process.env['RUNNER_TEMP'], name, version, os.arch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package path to the tool cache.
|
||||
*
|
||||
* @see https://github.com/actions/toolkit/blob/daf8bb00606d37ee2431d9b1596b88513dcf9c59/packages/tool-cache/src/tool-cache.ts#L747-L749
|
||||
*/
|
||||
export function toolPath(name: string, version: string): string {
|
||||
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
|
||||
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import {
|
||||
CommentInput,
|
||||
commentInput,
|
||||
commentAction,
|
||||
DEFAULT_ID,
|
||||
DEFAULT_MESSAGE,
|
||||
} from '../../src/actions/preview-comment';
|
||||
import * as expo from '../../src/expo';
|
||||
import * as github from '../../src/github';
|
||||
import { mockInput } from '../utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('../../src/expo');
|
||||
jest.mock('../../src/github');
|
||||
jest.mock('../../src/worker');
|
||||
|
||||
describe(commentInput, () => {
|
||||
it('returns object with correct defaults', () => {
|
||||
expect(commentInput()).toMatchObject({
|
||||
channel: 'default',
|
||||
comment: true,
|
||||
message: DEFAULT_MESSAGE,
|
||||
messageId: DEFAULT_ID,
|
||||
project: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it('returns project path', () => {
|
||||
mockInput({ project: 'fake/project' });
|
||||
expect(commentInput()).toMatchObject({ project: 'fake/project' });
|
||||
});
|
||||
|
||||
it('returns disabled comment', () => {
|
||||
mockInput({ comment: 'false' });
|
||||
expect(commentInput()).toMatchObject({ comment: false });
|
||||
});
|
||||
|
||||
it('returns message and id', () => {
|
||||
mockInput({ message: 'fake message', 'message-id': 'fake id' });
|
||||
expect(commentInput()).toMatchObject({ message: 'fake message', messageId: 'fake id' });
|
||||
});
|
||||
|
||||
it('returns channel', () => {
|
||||
mockInput({ channel: 'pr-420' });
|
||||
expect(commentInput()).toMatchObject({ channel: 'pr-420' });
|
||||
});
|
||||
});
|
||||
|
||||
describe(commentAction, () => {
|
||||
const input: CommentInput = {
|
||||
channel: 'default',
|
||||
comment: false,
|
||||
message: DEFAULT_MESSAGE,
|
||||
messageId: DEFAULT_ID,
|
||||
project: '',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.mocked(expo.projectInfo).mockResolvedValue({ name: 'fakename', slug: 'fakeslug' });
|
||||
jest.mocked(expo.projectOwner).mockResolvedValue('fakeuser');
|
||||
});
|
||||
|
||||
it('resolves project info by project path', async () => {
|
||||
await commentAction({ ...input, project: 'fake/path' });
|
||||
expect(expo.projectInfo).toBeCalledWith('fake/path');
|
||||
});
|
||||
|
||||
it('resolves project owner info by manifest owner', async () => {
|
||||
jest.mocked(expo.projectInfo).mockResolvedValue({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' });
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectOwner', 'fakeowner');
|
||||
expect(expo.projectOwner).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('resolves project owner info by current user', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectOwner', 'fakeuser');
|
||||
});
|
||||
|
||||
it('creates comment when enabled', async () => {
|
||||
await commentAction({ ...input, comment: true });
|
||||
expect(github.pullContext).toBeCalled();
|
||||
expect(github.createIssueComment).toBeCalled();
|
||||
});
|
||||
|
||||
it('resolves the template variables for message', async () => {
|
||||
await commentAction({ ...input });
|
||||
const message = jest.mocked(core.setOutput).mock.calls.find(call => call[0] === 'message');
|
||||
expect(message![1]).not.toMatch(DEFAULT_MESSAGE);
|
||||
});
|
||||
|
||||
describe('outputs', () => {
|
||||
it('sets projectOwner', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectOwner', 'fakeuser');
|
||||
});
|
||||
|
||||
it('sets projectName', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectName', 'fakename');
|
||||
});
|
||||
|
||||
it('sets projectSlug', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectSlug', 'fakeslug');
|
||||
});
|
||||
|
||||
it('sets projectLink', async () => {
|
||||
jest.mocked(expo.projectLink).mockReturnValue('https://expo.dev/@fakeuser/fakeslug');
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectLink', 'https://expo.dev/@fakeuser/fakeslug');
|
||||
});
|
||||
|
||||
it('sets projectQR', async () => {
|
||||
jest.mocked(expo.projectQR).mockReturnValue('https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectQR', 'https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
|
||||
});
|
||||
|
||||
it('sets message', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('message', expect.any(String));
|
||||
});
|
||||
|
||||
it('sets messageId', async () => {
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('messageId', expect.any(String));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,110 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import { SetupInput, setupInput, setupAction } from '../../src/actions/setup';
|
||||
import * as cacher from '../../src/cacher';
|
||||
import * as expo from '../../src/expo';
|
||||
import * as packager from '../../src/packager';
|
||||
import * as worker from '../../src/worker';
|
||||
import { mockInput } from '../utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('../../src/cacher');
|
||||
jest.mock('../../src/expo');
|
||||
jest.mock('../../src/packager');
|
||||
jest.mock('../../src/worker');
|
||||
|
||||
describe(setupInput, () => {
|
||||
it('returns object with correct defaults', () => {
|
||||
expect(setupInput()).toMatchObject({
|
||||
easCache: true,
|
||||
easVersion: undefined,
|
||||
expoCache: true,
|
||||
expoVersion: undefined,
|
||||
packager: 'yarn',
|
||||
patchWatchers: true,
|
||||
token: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it('returns expo version and cache', () => {
|
||||
mockInput({ 'expo-version': '5.x', 'expo-cache': 'true' });
|
||||
expect(setupInput()).toMatchObject({ expoVersion: '5.x', expoCache: true });
|
||||
});
|
||||
|
||||
it('returns eas version and cache', () => {
|
||||
mockInput({ 'eas-version': 'latest', 'eas-cache': 'true' });
|
||||
expect(setupInput()).toMatchObject({ easVersion: 'latest', easCache: true });
|
||||
});
|
||||
|
||||
it('returns different packager', () => {
|
||||
mockInput({ packager: 'npm' });
|
||||
expect(setupInput()).toMatchObject({ packager: 'npm' });
|
||||
});
|
||||
|
||||
it('returns disabled patch watchers', () => {
|
||||
mockInput({ 'patch-watchers': 'false' });
|
||||
expect(setupInput()).toMatchObject({ patchWatchers: false });
|
||||
});
|
||||
|
||||
it('returns token', () => {
|
||||
mockInput({ token: 'faketoken' });
|
||||
expect(setupInput()).toMatchObject({ token: 'faketoken' });
|
||||
});
|
||||
});
|
||||
|
||||
describe(setupAction, () => {
|
||||
const input: SetupInput = {
|
||||
easCache: false,
|
||||
easVersion: '',
|
||||
expoCache: false,
|
||||
expoVersion: '',
|
||||
packager: 'yarn',
|
||||
patchWatchers: true,
|
||||
token: '',
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
jest.mocked(core.group).mockImplementation((_, action) => action());
|
||||
});
|
||||
|
||||
['expo', 'eas'].forEach(cli => {
|
||||
const cliName = `${cli}-cli`;
|
||||
const cliVersion = `${cli}Version`;
|
||||
const cliCache = `${cli}Cache`;
|
||||
|
||||
it(`installs ${cliName} using npm`, async () => {
|
||||
jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3');
|
||||
await setupAction({ ...input, [cliVersion]: '5.x', [cliCache]: false, packager: 'npm' });
|
||||
expect(packager.installPackage).toBeCalledWith(cliName, '5.0.3', 'npm');
|
||||
expect(worker.installToolFromPackage).toBeCalled();
|
||||
});
|
||||
|
||||
it(`installs ${cliName} from cache`, async () => {
|
||||
jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3');
|
||||
jest.mocked(cacher.restoreFromCache).mockResolvedValue('fake/path');
|
||||
await setupAction({ ...input, [cliVersion]: 'latest', [cliCache]: true });
|
||||
expect(packager.installPackage).not.toBeCalled();
|
||||
expect(worker.installToolFromPackage).toBeCalledWith('fake/path');
|
||||
});
|
||||
});
|
||||
|
||||
it('authenticates token with eas-cli by default', async () => {
|
||||
await setupAction({ ...input, expoVersion: 'latest', easVersion: 'latest', token: 'faketoken' });
|
||||
expect(expo.authenticate).toBeCalledWith('faketoken', 'eas');
|
||||
});
|
||||
|
||||
it('authenticates token with expo-cli without eas-cli', async () => {
|
||||
await setupAction({ ...input, expoVersion: 'latest', token: 'faketoken' });
|
||||
expect(expo.authenticate).toBeCalledWith('faketoken', 'expo');
|
||||
});
|
||||
|
||||
it('authenticates token without any cli', async () => {
|
||||
await setupAction({ ...input, token: 'faketoken' });
|
||||
expect(expo.authenticate).toBeCalledWith('faketoken', undefined);
|
||||
});
|
||||
|
||||
it('patches watchers', async () => {
|
||||
await setupAction({ ...input, patchWatchers: true });
|
||||
expect(worker.patchWatchers).toBeCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,131 +0,0 @@
|
||||
import os from 'os';
|
||||
import { join } from 'path';
|
||||
import * as remoteCache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as toolCache from '@actions/tool-cache';
|
||||
|
||||
import * as cache from '../src/cache';
|
||||
import * as utils from './utils';
|
||||
|
||||
describe('fromLocalCache', () => {
|
||||
it('fetches the version specific cache', async () => {
|
||||
const path = join('path', 'to', 'local', 'cache');
|
||||
// todo: check why jest wants `never` instead of `string`
|
||||
const find = jest.spyOn(toolCache, 'find').mockResolvedValue(path as never);
|
||||
const result = await cache.fromLocalCache('3.20.1');
|
||||
expect(result).toBe(path);
|
||||
expect(find).toBeCalledWith('expo-cli', '3.20.1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('toLocalCache', () => {
|
||||
it('stores the version specific cache', async () => {
|
||||
const path = join('path', 'to', 'local', 'cache');
|
||||
const root = join('path', 'from', 'source');
|
||||
const cacheDir = jest.spyOn(toolCache, 'cacheDir').mockResolvedValue(path);
|
||||
const result = await cache.toLocalCache(root, '3.20.1');
|
||||
expect(result).toBe(path);
|
||||
expect(cacheDir).toBeCalledWith(root, 'expo-cli', '3.20.1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('fromRemoteCache', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = {
|
||||
restore: jest.spyOn(remoteCache, 'restoreCache').mockImplementation(),
|
||||
warning: jest.spyOn(core, 'warning').mockImplementation(),
|
||||
};
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
utils.setEnv('RUNNER_TOOL_CACHE', join('cache', 'path'));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
utils.restoreEnv();
|
||||
spy.restore.mockRestore();
|
||||
spy.warning.mockRestore();
|
||||
});
|
||||
|
||||
it('restores remote cache with default key', async () => {
|
||||
expect(await cache.fromRemoteCache('3.20.1', 'yarn')).toBeUndefined();
|
||||
expect(remoteCache.restoreCache).toBeCalledWith(
|
||||
[join('cache', 'path', 'expo-cli', '3.20.1', os.arch())],
|
||||
`expo-cli-${process.platform}-${os.arch()}-yarn-3.20.1`,
|
||||
);
|
||||
});
|
||||
|
||||
it('restores remote cache with custom key', async () => {
|
||||
expect(await cache.fromRemoteCache('3.20.0', 'yarn', 'custom-cache-key')).toBeUndefined();
|
||||
expect(remoteCache.restoreCache).toBeCalledWith(
|
||||
[join('cache', 'path', 'expo-cli', '3.20.0', os.arch())],
|
||||
'custom-cache-key',
|
||||
);
|
||||
});
|
||||
|
||||
it('returns path when remote cache exists', async () => {
|
||||
spy.restore.mockResolvedValueOnce(true);
|
||||
await expect(cache.fromRemoteCache('3.20.1', 'npm')).resolves.toBe(
|
||||
join('cache', 'path', 'expo-cli', '3.20.1', os.arch())
|
||||
);
|
||||
});
|
||||
|
||||
it('fails when remote cache throws', async () => {
|
||||
const error = new Error('Remote cache restore failed');
|
||||
spy.restore.mockRejectedValueOnce(error);
|
||||
await expect(cache.fromRemoteCache('3.20.1', 'yarn')).rejects.toBe(error);
|
||||
});
|
||||
|
||||
it('skips remote cache when unavailable', async () => {
|
||||
// see: https://github.com/actions/toolkit/blob/9167ce1f3a32ad495fc1dbcb574c03c0e013ae53/packages/cache/src/internal/cacheHttpClient.ts#L41
|
||||
const error = new Error('Cache Service Url not found, unable to restore cache.');
|
||||
spy.restore.mockRejectedValueOnce(error);
|
||||
await expect(cache.fromRemoteCache('3.20.1', 'yarn')).resolves.toBeUndefined();
|
||||
expect(spy.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping remote cache'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('toRemoteCache', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = {
|
||||
save: jest.spyOn(remoteCache, 'saveCache').mockImplementation(),
|
||||
warning: jest.spyOn(core, 'warning').mockImplementation(),
|
||||
};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.save.mockRestore();
|
||||
spy.warning.mockRestore();
|
||||
});
|
||||
|
||||
it('saves remote cache with default key', async () => {
|
||||
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'npm')).toBeUndefined();
|
||||
expect(remoteCache.saveCache).toBeCalledWith(
|
||||
[join('local', 'path')],
|
||||
`expo-cli-${process.platform}-${os.arch()}-npm-3.20.1`
|
||||
);
|
||||
});
|
||||
|
||||
it('saves remote cache with custom key', async () => {
|
||||
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn', 'custom-cache-key')).toBeUndefined();
|
||||
expect(remoteCache.saveCache).toBeCalledWith([join('local', 'path')], 'custom-cache-key');
|
||||
});
|
||||
|
||||
it('fails when remote cache throws', async () => {
|
||||
const error = new Error('Remote cache save failed');
|
||||
spy.save.mockRejectedValueOnce(error);
|
||||
await expect(cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn')).rejects.toBe(error);
|
||||
});
|
||||
|
||||
it('skips remote cache when unavailable', async () => {
|
||||
// see: https://github.com/actions/toolkit/blob/9167ce1f3a32ad495fc1dbcb574c03c0e013ae53/packages/cache/src/internal/cacheHttpClient.ts#L41
|
||||
const error = new Error('Cache Service Url not found, unable to restore cache.');
|
||||
spy.save.mockRejectedValueOnce(error);
|
||||
await expect(cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn')).resolves.toBeUndefined();
|
||||
expect(spy.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping remote cache'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import os from 'os';
|
||||
|
||||
import { cacheKey, restoreFromCache, saveToCache } from '../src/cacher';
|
||||
import { toolPath } from '../src/worker';
|
||||
import { resetEnv, setEnv } from './utils';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
|
||||
beforeAll(() => {
|
||||
setEnv('RUNNER_TOOL_CACHE', os.tmpdir());
|
||||
});
|
||||
|
||||
afterAll(resetEnv);
|
||||
|
||||
describe(cacheKey, () => {
|
||||
it('returns contains package name, version, and manager', () => {
|
||||
expect(cacheKey('expo-cli', '5.0.3', 'yarn')).toMatch('expo-cli');
|
||||
expect(cacheKey('expo-cli', '5.0.3', 'yarn')).toMatch('5.0.3');
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'npm')).toMatch('npm');
|
||||
});
|
||||
|
||||
it('contains the os arch type', () => {
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'yarn')).toMatch(os.arch());
|
||||
});
|
||||
|
||||
it('contains the platform type', () => {
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'yarn')).toMatch(process.platform);
|
||||
});
|
||||
});
|
||||
|
||||
describe(restoreFromCache, () => {
|
||||
it('skips when cache is unavailable', async () => {
|
||||
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Cache service url not found'));
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('throws when cache has unexpected error', async () => {
|
||||
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Node registry is down'));
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
|
||||
});
|
||||
|
||||
it('returns expo-cli path from cache when available', async () => {
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue('fake/path');
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(toolPath('expo-cli', '5.0.3'));
|
||||
});
|
||||
|
||||
it('returns nothing when cache is empty', async () => {
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue(undefined);
|
||||
await expect(restoreFromCache('eas-cli', '0.46.2', 'npm')).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe(saveToCache, () => {
|
||||
it('skips when cache is unavailable', async () => {
|
||||
jest.mocked(cache.saveCache).mockRejectedValue(new Error('Cache service url not found'));
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('throws when cache has unexpected error', async () => {
|
||||
jest.mocked(cache.saveCache).mockRejectedValue(new Error('Node registry is down'));
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
|
||||
});
|
||||
|
||||
it('saves expo-cli to cache when available', async () => {
|
||||
jest.mocked(cache.saveCache).mockResolvedValue(1337);
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
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';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
jest.mock('@actions/io');
|
||||
|
||||
describe(authenticate, () => {
|
||||
it('exports EXPO_TOKEN variable', async () => {
|
||||
await authenticate('faketoken', undefined);
|
||||
expect(core.exportVariable).toBeCalledWith('EXPO_TOKEN', 'faketoken');
|
||||
});
|
||||
|
||||
it('validates EXPO_TOKEN with expo-cli', async () => {
|
||||
jest.mocked(io.which).mockResolvedValue('expo');
|
||||
await authenticate('faketoken', 'expo');
|
||||
expect(io.which).toBeCalledWith('expo');
|
||||
expect(exec.exec).toBeCalledWith('expo', ['whoami'], {
|
||||
env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }),
|
||||
});
|
||||
});
|
||||
|
||||
it('validates EXPO_TOKEN with eas-cli', async () => {
|
||||
jest.mocked(io.which).mockResolvedValue('eas');
|
||||
await authenticate('faketoken', 'eas');
|
||||
expect(io.which).toBeCalledWith('eas');
|
||||
expect(exec.exec).toBeCalledWith('eas', ['whoami'], {
|
||||
env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(projectQR, () => {
|
||||
it('throws when owner is undefined', () => {
|
||||
expect(() => projectQR({ name: 'fakename', slug: 'fakeslug' })).toThrow('without owner');
|
||||
});
|
||||
|
||||
it('returns url with owner and slug', () => {
|
||||
expect(projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' })).toBe(
|
||||
'https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns url with owner, slug, and release channel', () => {
|
||||
expect(projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
|
||||
'https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug&releaseChannel=fakechannel'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe(projectLink, () => {
|
||||
it('throws when owner is undefined', () => {
|
||||
expect(() => projectLink({ name: 'fakename', slug: 'fakeslug' })).toThrow('without owner');
|
||||
});
|
||||
|
||||
it('returns url with owner and slug', () => {
|
||||
expect(projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' })).toBe(
|
||||
'https://expo.dev/@fakeowner/fakeslug'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns url with owner, slug, and release channel', () => {
|
||||
expect(projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
|
||||
'https://expo.dev/@fakeowner/fakeslug?release-channel=fakechannel'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import { githubApi, pullContext } from '../src/github';
|
||||
import { setEnv, resetEnv } from './utils';
|
||||
|
||||
jest.mock('@actions/github');
|
||||
|
||||
describe(githubApi, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('throws when GITHUB_TOKEN is undefined', () => {
|
||||
setEnv('GITHUB_TOKEN', '');
|
||||
expect(() => githubApi()).toThrow(`requires a GITHUB_TOKEN`);
|
||||
});
|
||||
|
||||
it('returns an octokit instance', () => {
|
||||
setEnv('GITHUB_TOKEN', 'fakegithubtoken');
|
||||
const fakeGithub = {};
|
||||
jest.mocked(github.getOctokit).mockReturnValue(fakeGithub as any);
|
||||
expect(githubApi()).toBe(fakeGithub);
|
||||
expect(github.getOctokit).toBeCalledWith('fakegithubtoken');
|
||||
});
|
||||
});
|
||||
|
||||
describe(pullContext, () => {
|
||||
it('throws when github context event is not a pull request', () => {
|
||||
jest.mocked(github.context).eventName = 'push';
|
||||
expect(() => pullContext()).toThrow('Could not find the pull request context');
|
||||
});
|
||||
|
||||
it('returns pull request context', () => {
|
||||
jest.mocked(github.context).eventName = 'pull_request';
|
||||
jest.mocked(github.context).issue = { owner: 'fakeowner', repo: 'fakerepo', number: 1337 };
|
||||
expect(pullContext()).toMatchObject({ owner: 'fakeowner', repo: 'fakerepo', number: 1337 });
|
||||
});
|
||||
});
|
||||
@@ -1,80 +0,0 @@
|
||||
const cli = { exec: jest.fn() };
|
||||
const io = { mkdirP: jest.fn(), which: jest.fn() };
|
||||
const cache = {
|
||||
fromLocalCache: jest.fn(),
|
||||
fromRemoteCache: jest.fn(),
|
||||
toLocalCache: jest.fn(),
|
||||
toRemoteCache: jest.fn(),
|
||||
};
|
||||
|
||||
jest.mock('@actions/exec', () => cli);
|
||||
jest.mock('@actions/io', () => io);
|
||||
jest.mock('../src/cache', () => cache);
|
||||
|
||||
import { join } from 'path';
|
||||
|
||||
import * as install from '../src/install';
|
||||
import * as utils from './utils';
|
||||
|
||||
describe('install', () => {
|
||||
it('installs path from local cache', async () => {
|
||||
cache.fromLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
});
|
||||
|
||||
it('installs path from packager and cache it locally', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.toLocalCache).toBeCalledWith(join('temp', 'path'), '3.0.10');
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('installs path from remote cache', async () => {
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.fromRemoteCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.fromRemoteCache).toBeCalledWith('3.20.1', 'npm', undefined);
|
||||
});
|
||||
|
||||
it('installs path from packager and cache it remotely', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.fromRemoteCache.mockResolvedValue(undefined);
|
||||
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.toRemoteCache).toBeCalledWith(join('cache', 'path'), '3.20.1', 'npm', undefined);
|
||||
utils.restoreEnv();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fromPackager', () => {
|
||||
it('resolves tool path', async () => {
|
||||
await install.fromPackager('3.0.10', 'npm');
|
||||
expect(io.which).toBeCalledWith('npm');
|
||||
});
|
||||
|
||||
it('creates temporary folder', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
await install.fromPackager('latest', 'yarn');
|
||||
expect(io.mkdirP).toBeCalledWith(join('temp', 'path'));
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('installs expo with tool', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
io.which.mockResolvedValue('npm');
|
||||
const expoPath = await install.fromPackager('beta', 'npm');
|
||||
expect(expoPath).toBe(join('temp', 'path'));
|
||||
expect(cli.exec).toBeCalled();
|
||||
expect(cli.exec.mock.calls[0][0]).toBe('npm');
|
||||
expect(cli.exec.mock.calls[0][1]).toStrictEqual(['add', 'expo-cli@beta']);
|
||||
expect(cli.exec.mock.calls[0][2]).toMatchObject({ cwd: join('temp', 'path') });
|
||||
utils.restoreEnv();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { resolvePackage } from '../src/packager';
|
||||
|
||||
describe(resolvePackage, () => {
|
||||
it('resolves expo-cli@^2.0.0 to 2.21.2', async () => {
|
||||
await expect(resolvePackage('expo-cli', '^2.0.0')).resolves.toBe('2.21.2');
|
||||
});
|
||||
|
||||
it('resolves expo-cli@~3.15.0 to 3.15.5', async () => {
|
||||
await expect(resolvePackage('expo-cli', '~3.15.0')).resolves.toBe('3.15.5');
|
||||
});
|
||||
|
||||
it('resolves eas-cli@~0.33.0 to 0.33.1', async () => {
|
||||
await expect(resolvePackage('eas-cli', '~0.33.0')).resolves.toBe('0.33.1');
|
||||
});
|
||||
|
||||
it('resolves expo-cli@latest to a version', async () => {
|
||||
await expect(resolvePackage('expo-cli', 'latest')).resolves.not.toMatch('latest');
|
||||
});
|
||||
|
||||
it('rejects donotpublishthispackageoryouwillbefired with proper error', async () => {
|
||||
await expect(resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')).rejects.toThrow(
|
||||
'Could not resolve'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,108 +0,0 @@
|
||||
const core = {
|
||||
addPath: jest.fn(),
|
||||
getInput: jest.fn(),
|
||||
group: (message: string, action: () => Promise<any>) => action()
|
||||
};
|
||||
const exec = { exec: jest.fn() };
|
||||
const install = { install: jest.fn() };
|
||||
const tools = {
|
||||
resolveVersion: jest.fn(v => v),
|
||||
maybeAuthenticate: jest.fn(),
|
||||
maybePatchWatchers: jest.fn(),
|
||||
};
|
||||
|
||||
jest.mock('@actions/core', () => core);
|
||||
jest.mock('@actions/exec', () => exec);
|
||||
jest.mock('../src/tools', () => tools);
|
||||
jest.mock('../src/install', () => install);
|
||||
|
||||
import { run } from '../src/run';
|
||||
|
||||
interface MockInputProps {
|
||||
version?: string;
|
||||
packager?: string;
|
||||
token?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
patchWatchers?: string;
|
||||
cache?: string;
|
||||
cacheKey?: string;
|
||||
}
|
||||
|
||||
const mockInput = (props: MockInputProps = {}) => {
|
||||
// fix: kind of dirty workaround for missing "mock 'value' based on arguments"
|
||||
const input = (name: string) => {
|
||||
switch (name) {
|
||||
case 'expo-version':
|
||||
return props.version || '';
|
||||
case 'expo-packager':
|
||||
return props.packager || '';
|
||||
case 'expo-token':
|
||||
return props.token || '';
|
||||
case 'expo-username':
|
||||
return props.username || '';
|
||||
case 'expo-password':
|
||||
return props.password || '';
|
||||
case 'expo-patch-watchers':
|
||||
return props.patchWatchers || '';
|
||||
case 'expo-cache':
|
||||
return props.cache || '';
|
||||
case 'expo-cache-key':
|
||||
return props.cacheKey || '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
core.getInput = input as any;
|
||||
};
|
||||
|
||||
describe('run', () => {
|
||||
it('installs latest expo-cli with yarn by default', async () => {
|
||||
await run();
|
||||
expect(install.install).toBeCalledWith({ version: 'latest', packager: 'yarn', cache: false });
|
||||
});
|
||||
|
||||
it('installs provided version expo-cli with npm', async () => {
|
||||
mockInput({ version: '3.0.10', packager: 'npm' });
|
||||
await run();
|
||||
expect(install.install).toBeCalledWith({ version: '3.0.10', packager: 'npm', cache: false });
|
||||
});
|
||||
|
||||
it('installs path to global path', async () => {
|
||||
install.install.mockResolvedValue('/expo/install/path');
|
||||
await run();
|
||||
expect(core.addPath).toBeCalledWith('/expo/install/path');
|
||||
});
|
||||
|
||||
it('patches the system when set to true', async () => {
|
||||
mockInput({ patchWatchers: 'true' });
|
||||
await run();
|
||||
expect(tools.maybePatchWatchers).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('patches the system when not set', async () => {
|
||||
mockInput({ patchWatchers: '' });
|
||||
await run();
|
||||
expect(tools.maybePatchWatchers).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('skips the system patch when set to false', async () => {
|
||||
mockInput({ patchWatchers: 'false' });
|
||||
await run();
|
||||
expect(tools.maybePatchWatchers).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('authenticates with provided credentials', async () => {
|
||||
mockInput({ username: 'bycedric', password: 'mypassword', patchWatchers: 'false' });
|
||||
await run();
|
||||
expect(tools.maybeAuthenticate).toBeCalledWith({ username: 'bycedric', password: 'mypassword' });
|
||||
});
|
||||
|
||||
it('authenticates with provided token', async () => {
|
||||
mockInput({ token: 'ABC123', patchWatchers: 'false' });
|
||||
await run();
|
||||
expect(tools.maybeAuthenticate).toBeCalledWith({ token: 'ABC123' });
|
||||
});
|
||||
});
|
||||
@@ -1,282 +0,0 @@
|
||||
const registry = { manifest: jest.fn() };
|
||||
jest.mock('libnpm', () => registry);
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import * as cli from '@actions/exec';
|
||||
|
||||
import * as tools from '../src/tools';
|
||||
import * as utils from './utils';
|
||||
|
||||
describe('resolveVersion', () => {
|
||||
it('fetches exact version of expo-cli', async () => {
|
||||
registry.manifest.mockResolvedValue({ version: '3.0.10' });
|
||||
expect(await tools.resolveVersion('latest')).toBe('3.0.10');
|
||||
expect(registry.manifest).toBeCalledWith('expo-cli@latest');
|
||||
});
|
||||
});
|
||||
|
||||
describe('maybeAuthenticate', () => {
|
||||
const token = 'ABC123';
|
||||
const username = 'bycedric';
|
||||
const password = 'mypassword';
|
||||
|
||||
describe('with token', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = {
|
||||
exportVariable: jest.spyOn(core, 'exportVariable').mockImplementation(),
|
||||
exec: jest.spyOn(cli, 'exec').mockImplementation(),
|
||||
info: jest.spyOn(core, 'info').mockImplementation(),
|
||||
};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.exportVariable.mockRestore();
|
||||
spy.exec.mockRestore();
|
||||
spy.info.mockRestore();
|
||||
});
|
||||
|
||||
it('skips authentication without token', async () => {
|
||||
await tools.maybeAuthenticate();
|
||||
expect(spy.exec).not.toBeCalled();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
|
||||
});
|
||||
|
||||
it('executes whoami command with token through environment', async () => {
|
||||
utils.setEnv('TEST_INCLUDED', 'hellyeah');
|
||||
await tools.maybeAuthenticate({ token });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][1]).toStrictEqual(['whoami']);
|
||||
expect(spy.exec.mock.calls[0][2]).toMatchObject({
|
||||
env: {
|
||||
TEST_INCLUDED: 'hellyeah',
|
||||
EXPO_TOKEN: token,
|
||||
},
|
||||
});
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('fails when token is incorrect', async () => {
|
||||
const error = new Error('Not logged in');
|
||||
spy.exec.mockRejectedValue(error);
|
||||
await expect(tools.maybeAuthenticate({ token })).rejects.toBe(error);
|
||||
});
|
||||
|
||||
it('executes whoami command with `expo` on macos', async () => {
|
||||
utils.setPlatform('darwin');
|
||||
await tools.maybeAuthenticate({ token });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes whoami command with `expo` on ubuntu', async () => {
|
||||
utils.setPlatform('linux');
|
||||
await tools.maybeAuthenticate({ token });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes whoami command with `expo.cmd` on windows', async () => {
|
||||
utils.setPlatform('win32');
|
||||
await tools.maybeAuthenticate({ token });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo.cmd');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
});
|
||||
|
||||
describe('credentials', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = {
|
||||
exec: jest.spyOn(cli, 'exec').mockImplementation(),
|
||||
info: jest.spyOn(core, 'info').mockImplementation(),
|
||||
};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.exec.mockRestore();
|
||||
spy.info.mockRestore();
|
||||
});
|
||||
|
||||
it('skips authentication without credentials', async () => {
|
||||
await tools.maybeAuthenticate();
|
||||
expect(spy.exec).not.toBeCalled();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
|
||||
});
|
||||
|
||||
it('skips authentication without password', async () => {
|
||||
await tools.maybeAuthenticate({ username });
|
||||
expect(spy.exec).not.toBeCalled();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
|
||||
});
|
||||
|
||||
it('executes login command with password through environment', async () => {
|
||||
utils.setEnv('TEST_INCLUDED', 'hellyeah');
|
||||
await tools.maybeAuthenticate({ username, password })
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][1]).toStrictEqual(['login', `--username=${username}`]);
|
||||
expect(spy.exec.mock.calls[0][2]).toMatchObject({
|
||||
env: {
|
||||
TEST_INCLUDED: 'hellyeah',
|
||||
EXPO_CLI_PASSWORD: password,
|
||||
},
|
||||
});
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('fails when credentials are incorrect', async () => {
|
||||
const error = new Error('Invalid username/password. Please try again.');
|
||||
spy.exec.mockRejectedValue(error);
|
||||
await expect(tools.maybeAuthenticate({ username, password }))
|
||||
.rejects
|
||||
.toBe(error);
|
||||
});
|
||||
|
||||
it('executes login command with `expo` on macos', async () => {
|
||||
utils.setPlatform('darwin');
|
||||
await tools.maybeAuthenticate({ username, password });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes login command with `expo` on ubuntu', async () => {
|
||||
utils.setPlatform('linux');
|
||||
await tools.maybeAuthenticate({ username, password });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes login command with `expo.cmd` on windows', async () => {
|
||||
utils.setPlatform('win32');
|
||||
await tools.maybeAuthenticate({ username, password });
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo.cmd');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('maybePatchWatchers', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = {
|
||||
info: jest.spyOn(core, 'info').mockImplementation(),
|
||||
warning: jest.spyOn(core, 'warning').mockImplementation(),
|
||||
exec: jest.spyOn(cli, 'exec').mockImplementation(),
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.info.mockRestore();
|
||||
spy.warning.mockRestore();
|
||||
spy.exec.mockRestore();
|
||||
});
|
||||
|
||||
it('increses fs inotify settings with sysctl', async () => {
|
||||
utils.setPlatform('linux');
|
||||
await tools.maybePatchWatchers();
|
||||
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
expect(spy.exec).toBeCalledWith('sudo sysctl -p');
|
||||
});
|
||||
|
||||
it('warns for unsuccessful patches', async () => {
|
||||
const error = new Error('Something went wrong');
|
||||
spy.exec.mockRejectedValueOnce(error);
|
||||
utils.setPlatform('linux');
|
||||
await tools.maybePatchWatchers();
|
||||
expect(core.warning).toBeCalledWith(expect.stringContaining("can't patch watchers"));
|
||||
expect(core.warning).toBeCalledWith(
|
||||
expect.stringContaining('https://github.com/expo/expo-github-action/issues/20')
|
||||
);
|
||||
});
|
||||
|
||||
it('skips on windows platform', async () => {
|
||||
utils.setPlatform('win32');
|
||||
await tools.maybePatchWatchers();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
|
||||
expect(spy.exec).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('skips on macos platform', async () => {
|
||||
utils.setPlatform('darwin');
|
||||
await tools.maybePatchWatchers();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
|
||||
expect(spy.exec).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('runs on linux platform', async () => {
|
||||
utils.setPlatform('linux');
|
||||
await tools.maybePatchWatchers();
|
||||
expect(spy.info).toBeCalledWith(expect.stringContaining('Patching'));
|
||||
expect(spy.exec).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('maybeWarnForUpdate', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = { warning: jest.spyOn(core, 'warning').mockImplementation() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.warning.mockRestore();
|
||||
});
|
||||
|
||||
it('is silent when major version is up to date', async () => {
|
||||
registry.manifest
|
||||
.mockResolvedValueOnce({ version: '4.1.0' })
|
||||
.mockResolvedValueOnce({ version: '4.0.1'});
|
||||
await tools.maybeWarnForUpdate();
|
||||
expect(spy.warning).not.toBeCalled();
|
||||
})
|
||||
|
||||
it('warns when major version is outdated', async () => {
|
||||
registry.manifest
|
||||
.mockResolvedValueOnce({ version: '4.1.0' })
|
||||
.mockResolvedValueOnce({ version: '3.0.1'});
|
||||
await tools.maybeWarnForUpdate();
|
||||
expect(spy.warning).toBeCalledWith('There is a new major version available of the Expo CLI (4.1.0)');
|
||||
expect(spy.warning).toBeCalledWith('If you run into issues, try upgrading your workflow to "expo-version: 4.x"');
|
||||
})
|
||||
});
|
||||
|
||||
describe('handleError', () => {
|
||||
let spy: { [key: string]: jest.SpyInstance } = {};
|
||||
|
||||
beforeEach(() => {
|
||||
spy = { setFailed: jest.spyOn(core, 'setFailed').mockImplementation() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.setFailed.mockRestore();
|
||||
});
|
||||
|
||||
it('marks the job as failed', async () => {
|
||||
const error = new Error('test');
|
||||
registry.manifest.mockResolvedValue('4.0.0');
|
||||
await tools.handleError(error);
|
||||
expect(core.setFailed).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
it('fails with original error when update warning failed', async () => {
|
||||
const error = new Error('test');
|
||||
registry.manifest.mockRejectedValue(new Error('npm issue'));
|
||||
await tools.handleError(error);
|
||||
expect(core.setFailed).toBeCalledWith(error);
|
||||
});
|
||||
});
|
||||
+16
-6
@@ -1,3 +1,5 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
// keep track of the original one to revert the platform
|
||||
const originalPlatform = process.platform;
|
||||
|
||||
@@ -6,14 +8,14 @@ const originalPlatform = process.platform;
|
||||
* With this you can fake the `process.platform`.
|
||||
*/
|
||||
export function setPlatform(platform: NodeJS.Platform): void {
|
||||
Object.defineProperty(process, 'platform', { value: platform });
|
||||
Object.defineProperty(process, 'platform', { value: platform });
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the platform to the original one.
|
||||
*/
|
||||
export function restorePlatform(): void {
|
||||
setPlatform(originalPlatform);
|
||||
export function resetPlatform(): void {
|
||||
setPlatform(originalPlatform);
|
||||
}
|
||||
|
||||
// keep track of the original environment variables
|
||||
@@ -23,12 +25,20 @@ const originalEnv = { ...process.env };
|
||||
* Change the environment variable for testing purposes.
|
||||
*/
|
||||
export function setEnv(name: string, value: string): void {
|
||||
process.env[name] = value;
|
||||
process.env[name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the environment variable changes.
|
||||
*/
|
||||
export function restoreEnv(): void {
|
||||
process.env = originalEnv;
|
||||
export function resetEnv(): void {
|
||||
process.env = originalEnv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock both the input and boolean input methods from `@actions/core`.
|
||||
*/
|
||||
export function mockInput(inputs: Record<string, string> = {}) {
|
||||
jest.mocked(core.getInput).mockImplementation(name => inputs[name]);
|
||||
jest.mocked(core.getBooleanInput).mockImplementation(name => inputs[name] === 'true');
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import { tempPath, toolPath, installToolFromPackage, patchWatchers, executeAction } from '../src/worker';
|
||||
import { resetEnv, setEnv, setPlatform, resetPlatform } from './utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
|
||||
describe(tempPath, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('throws when RUNNER_TEMP is undefined', () => {
|
||||
setEnv('RUNNER_TEMP', '');
|
||||
expect(tempPath).toThrow(`RUNNER_TEMP not defined`);
|
||||
});
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TEMP', 'fake/temp');
|
||||
expect(tempPath('expo-cli', '5.0.3')).toBe(path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
describe(toolPath, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('throws when RUNNER_TOOL_CACHE is undefined', () => {
|
||||
setEnv('RUNNER_TOOL_CACHE', '');
|
||||
expect(toolPath).toThrow(`RUNNER_TOOL_CACHE not defined`);
|
||||
});
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TOOL_CACHE', 'fake/tool');
|
||||
expect(toolPath('eas-cli', '0.34.3')).toBe(path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
describe(installToolFromPackage, () => {
|
||||
it('registers path to <dir>/node_modules/.bin', () => {
|
||||
installToolFromPackage('fake/install');
|
||||
expect(core.addPath).toBeCalledWith(path.join('fake', 'install', 'node_modules', '.bin'));
|
||||
});
|
||||
});
|
||||
|
||||
describe(patchWatchers, () => {
|
||||
afterEach(resetPlatform);
|
||||
|
||||
it('skips patches on windows', async () => {
|
||||
setPlatform('win32');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('skips patches on macos', async () => {
|
||||
setPlatform('darwin');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('patches on ubuntu', async () => {
|
||||
setPlatform('linux');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl -p');
|
||||
});
|
||||
|
||||
it('handles exception from commands', async () => {
|
||||
setPlatform('linux');
|
||||
jest
|
||||
.mocked(exec.exec)
|
||||
.mockResolvedValueOnce(0)
|
||||
.mockResolvedValueOnce(0)
|
||||
.mockRejectedValueOnce(new Error('fake error'));
|
||||
await expect(patchWatchers()).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe(executeAction, () => {
|
||||
it('executes action', async () => {
|
||||
const action = jest.fn(() => Promise.resolve());
|
||||
await executeAction(action);
|
||||
expect(action).toBeCalled();
|
||||
});
|
||||
|
||||
it('handles action errors', async () => {
|
||||
const error = new Error('fake error');
|
||||
const action = jest.fn(() => Promise.reject(error));
|
||||
await expect(executeAction(action)).resolves.not.toThrow();
|
||||
expect(core.setFailed).toBeCalledWith(error.message);
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"extends": "./node_modules/@tsconfig/node14/tsconfig.json",
|
||||
"extends": "./node_modules/@tsconfig/node16/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"noImplicitAny": false
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"exclude": [
|
||||
"build",
|
||||
|
||||
Reference in new issue
Block a user