From 2d2e74dd92fe9c92889713db3f151049090102d0 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 17:44:09 -0300 Subject: [PATCH 1/8] flatten output --- .../dist/{src => }/event-handlers/index.js | 0 .../event-handlers/on-pull-request/index.js | 0 .../on-pull-request/on-closed.js | 0 .../on-pull-request/on-synchronized.js | 0 .../event-handlers/on-pull-request/params.js | 0 .../{src => }/event-handlers/on-push/index.js | 0 .../event-handlers/on-push/params.js | 0 packages/action/dist/{src => }/index.js | 0 packages/action/dist/{src => }/interface.js | 0 .../dist/{src => }/services/remove-app.js | 0 .../dist/{src => }/services/sync-app.js | 41 +- .../action/dist/spec/fixtures/manifest.js | 41 -- .../dist/spec/fixtures/on-pull-request.js | 496 ------------------ .../dist/spec/fixtures/on-push-github.js | 200 ------- .../dist/spec/template/default/index.js | 30 -- .../default/components/body/body.html | 0 .../template/default/components/body/body.js | 0 .../default/components/card/card.html | 0 .../template/default/components/card/card.js | 0 .../review-app-list/review-app-list.html | 0 .../review-app-list/review-app-list.js | 0 .../dist/{src => }/template/default/index.js | 0 .../{src => }/template/default/layout.html | 0 .../dist/{src => }/template/default/layout.js | 0 .../{src => }/template/default/to-html.js | 0 .../dist/{src => }/utils/file-manager.js | 0 packages/action/dist/{src => }/utils/git.js | 0 .../action/dist/{src => }/utils/log-error.js | 0 .../action/dist/{src => }/utils/manifest.js | 0 packages/action/dist/{src => }/utils/retry.js | 0 .../action/dist/{src => }/utils/user-input.js | 0 packages/action/package.json | 4 +- .../event-handlers/on-pull-request/params.ts | 3 +- .../src/event-handlers/on-push/params.ts | 3 +- packages/action/src/services/sync-app.ts | 49 +- packages/action/tsconfig.json | 4 +- 36 files changed, 68 insertions(+), 803 deletions(-) rename packages/action/dist/{src => }/event-handlers/index.js (100%) rename packages/action/dist/{src => }/event-handlers/on-pull-request/index.js (100%) rename packages/action/dist/{src => }/event-handlers/on-pull-request/on-closed.js (100%) rename packages/action/dist/{src => }/event-handlers/on-pull-request/on-synchronized.js (100%) rename packages/action/dist/{src => }/event-handlers/on-pull-request/params.js (100%) rename packages/action/dist/{src => }/event-handlers/on-push/index.js (100%) rename packages/action/dist/{src => }/event-handlers/on-push/params.js (100%) rename packages/action/dist/{src => }/index.js (100%) rename packages/action/dist/{src => }/interface.js (100%) rename packages/action/dist/{src => }/services/remove-app.js (100%) rename packages/action/dist/{src => }/services/sync-app.js (88%) delete mode 100644 packages/action/dist/spec/fixtures/manifest.js delete mode 100644 packages/action/dist/spec/fixtures/on-pull-request.js delete mode 100644 packages/action/dist/spec/fixtures/on-push-github.js delete mode 100644 packages/action/dist/spec/template/default/index.js rename packages/action/dist/{src => }/template/default/components/body/body.html (100%) rename packages/action/dist/{src => }/template/default/components/body/body.js (100%) rename packages/action/dist/{src => }/template/default/components/card/card.html (100%) rename packages/action/dist/{src => }/template/default/components/card/card.js (100%) rename packages/action/dist/{src => }/template/default/components/review-app-list/review-app-list.html (100%) rename packages/action/dist/{src => }/template/default/components/review-app-list/review-app-list.js (100%) rename packages/action/dist/{src => }/template/default/index.js (100%) rename packages/action/dist/{src => }/template/default/layout.html (100%) rename packages/action/dist/{src => }/template/default/layout.js (100%) rename packages/action/dist/{src => }/template/default/to-html.js (100%) rename packages/action/dist/{src => }/utils/file-manager.js (100%) rename packages/action/dist/{src => }/utils/git.js (100%) rename packages/action/dist/{src => }/utils/log-error.js (100%) rename packages/action/dist/{src => }/utils/manifest.js (100%) rename packages/action/dist/{src => }/utils/retry.js (100%) rename packages/action/dist/{src => }/utils/user-input.js (100%) diff --git a/packages/action/dist/src/event-handlers/index.js b/packages/action/dist/event-handlers/index.js similarity index 100% rename from packages/action/dist/src/event-handlers/index.js rename to packages/action/dist/event-handlers/index.js diff --git a/packages/action/dist/src/event-handlers/on-pull-request/index.js b/packages/action/dist/event-handlers/on-pull-request/index.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-pull-request/index.js rename to packages/action/dist/event-handlers/on-pull-request/index.js diff --git a/packages/action/dist/src/event-handlers/on-pull-request/on-closed.js b/packages/action/dist/event-handlers/on-pull-request/on-closed.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-pull-request/on-closed.js rename to packages/action/dist/event-handlers/on-pull-request/on-closed.js diff --git a/packages/action/dist/src/event-handlers/on-pull-request/on-synchronized.js b/packages/action/dist/event-handlers/on-pull-request/on-synchronized.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-pull-request/on-synchronized.js rename to packages/action/dist/event-handlers/on-pull-request/on-synchronized.js diff --git a/packages/action/dist/src/event-handlers/on-pull-request/params.js b/packages/action/dist/event-handlers/on-pull-request/params.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-pull-request/params.js rename to packages/action/dist/event-handlers/on-pull-request/params.js diff --git a/packages/action/dist/src/event-handlers/on-push/index.js b/packages/action/dist/event-handlers/on-push/index.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-push/index.js rename to packages/action/dist/event-handlers/on-push/index.js diff --git a/packages/action/dist/src/event-handlers/on-push/params.js b/packages/action/dist/event-handlers/on-push/params.js similarity index 100% rename from packages/action/dist/src/event-handlers/on-push/params.js rename to packages/action/dist/event-handlers/on-push/params.js diff --git a/packages/action/dist/src/index.js b/packages/action/dist/index.js similarity index 100% rename from packages/action/dist/src/index.js rename to packages/action/dist/index.js diff --git a/packages/action/dist/src/interface.js b/packages/action/dist/interface.js similarity index 100% rename from packages/action/dist/src/interface.js rename to packages/action/dist/interface.js diff --git a/packages/action/dist/src/services/remove-app.js b/packages/action/dist/services/remove-app.js similarity index 100% rename from packages/action/dist/src/services/remove-app.js rename to packages/action/dist/services/remove-app.js diff --git a/packages/action/dist/src/services/sync-app.js b/packages/action/dist/services/sync-app.js similarity index 88% rename from packages/action/dist/src/services/sync-app.js rename to packages/action/dist/services/sync-app.js index 327315a..15a3a7f 100644 --- a/packages/action/dist/src/services/sync-app.js +++ b/packages/action/dist/services/sync-app.js @@ -40,25 +40,17 @@ const log_error_1 = require("../utils/log-error"); const user_input_1 = require("../utils/user-input"); exports.syncApp = (0, log_error_1.withError)(function syncApp(params) { return __awaiter(this, void 0, void 0, function* () { - const paths = fileManager.paths(params); const input = (0, user_input_1.userInput)(); - const PUBLIC_URL = `/${paths.byRepo}/${paths.byHeadCommit}`; + const paths = fileManager.paths(params); core.info(` - -> Paths: -> Your app will be hosted in github pages: + -> "https://${params.repository.owner}.github.io/${params.repository.name}" + + -> This app is served from: -> "https://${params.repository.owner}.github.io/${params.repository.name}/${paths.byHeadCommit}" - -> We'll build your app with the proper PUBLIC_URL: ${PUBLIC_URL} - -> For more info: - -> https://github.com/facebook/create-react-app/pull/937/files#diff-9b26877ecf8d15b7987c96e5a17502f6 - -> https://www.gatsbyjs.com/docs/path-prefix/ `); - core.info(` - -> Building app - `); - yield git.hardReset(params.branch.name); - core.exportVariable('PUBLIC_URL', PUBLIC_URL); - yield (0, exec_1.exec)(input.buildCmd); + yield optionalBuildApp(params); core.info(` -> Current working branch: ${params.branch.name}" -> Will move (and override) the build result on '${input.dist}' to '${paths.byHeadCommit}' in ${input.branch}" @@ -89,3 +81,26 @@ function updateApp(params) { yield git.push(input.branch); }); } +function optionalBuildApp(params) { + return __awaiter(this, void 0, void 0, function* () { + const input = (0, user_input_1.userInput)(); + if (!input.buildCmd) { + core.info('-> NO "buildCmd" passed, skipping build phase'); + return; + } + const paths = fileManager.paths(params); + const PUBLIC_URL = `/${paths.byRepo}/${paths.byHeadCommit}`; + core.info(` + -> BUILDING APP + + -> We'll build your app with the proper PUBLIC_URL: ${PUBLIC_URL} + -> That way you can use relative links inside your app. + -> For more info: + -> https://github.com/facebook/create-react-app/pull/937/files#diff-9b26877ecf8d15b7987c96e5a17502f6 + -> https://www.gatsbyjs.com/docs/path-prefix/ + `); + yield git.hardReset(params.branch.name); + core.exportVariable('PUBLIC_URL', PUBLIC_URL); + yield (0, exec_1.exec)(input.buildCmd); + }); +} diff --git a/packages/action/dist/spec/fixtures/manifest.js b/packages/action/dist/spec/fixtures/manifest.js deleted file mode 100644 index 3bc8bd4..0000000 --- a/packages/action/dist/spec/fixtures/manifest.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.manifest = void 0; -exports.manifest = { - 'issue-2-fix-button': { - apps: [ - { - name: 'Storybook review app', - headCommitId: '123asdf123asdf', - updatedAt: new Date(), - href: 'https://github.com', - pullRequestUrl: 'https://github.com', - }, - { - name: 'Blod review app', - headCommitId: '123asdf123asdf', - updatedAt: new Date(), - href: 'https://github.com', - pullRequestUrl: 'https://github.com', - }, - ], - }, - 'ft-add-new-thing': { - apps: [ - { - name: 'Storybook review app', - headCommitId: '123asdf123asdf', - updatedAt: new Date(), - href: 'https://github.com', - pullRequestUrl: 'https://github.com', - }, - { - name: 'Blod review app', - headCommitId: '123asdf123asdf', - updatedAt: new Date(), - href: 'https://github.com', - pullRequestUrl: 'https://github.com', - }, - ], - }, -}; diff --git a/packages/action/dist/spec/fixtures/on-pull-request.js b/packages/action/dist/spec/fixtures/on-pull-request.js deleted file mode 100644 index 25507ae..0000000 --- a/packages/action/dist/spec/fixtures/on-pull-request.js +++ /dev/null @@ -1,496 +0,0 @@ -"use strict"; -// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#push -Object.defineProperty(exports, "__esModule", { value: true }); -exports.onPullRequestGithubFixture = void 0; -exports.onPullRequestGithubFixture = { - action: 'synchronize', - after: '9839dbff11685875100adea8fdbe065bf5517fa7', - before: 'e0b6a0f07a3c483b72da9c7523601000ad57d182', - number: 14, - pull_request: { - _links: { - comments: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/issues/14/comments', - }, - commits: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14/commits', - }, - html: { - href: 'https://github.com/Sauloxd/review-apps/pull/14', - }, - issue: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/issues/14', - }, - review_comment: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/comments{/number}', - }, - review_comments: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14/comments', - }, - self: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14', - }, - statuses: { - href: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/9839dbff11685875100adea8fdbe065bf5517fa7', - }, - }, - active_lock_reason: null, - additions: 9, - assignee: null, - assignees: [], - author_association: 'OWNER', - auto_merge: null, - base: { - label: 'Sauloxd:main', - ref: 'main', - repo: { - allow_auto_merge: false, - allow_forking: true, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - allow_update_branch: false, - archive_url: 'https://api.github.com/repos/Sauloxd/review-apps/{archive_format}{/ref}', - archived: false, - assignees_url: 'https://api.github.com/repos/Sauloxd/review-apps/assignees{/user}', - blobs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/blobs{/sha}', - branches_url: 'https://api.github.com/repos/Sauloxd/review-apps/branches{/branch}', - clone_url: 'https://github.com/Sauloxd/review-apps.git', - collaborators_url: 'https://api.github.com/repos/Sauloxd/review-apps/collaborators{/collaborator}', - comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/comments{/number}', - commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/commits{/sha}', - compare_url: 'https://api.github.com/repos/Sauloxd/review-apps/compare/{base}...{head}', - contents_url: 'https://api.github.com/repos/Sauloxd/review-apps/contents/{+path}', - contributors_url: 'https://api.github.com/repos/Sauloxd/review-apps/contributors', - created_at: '2020-08-25T00:29:31Z', - default_branch: 'main', - delete_branch_on_merge: false, - deployments_url: 'https://api.github.com/repos/Sauloxd/review-apps/deployments', - description: null, - disabled: false, - downloads_url: 'https://api.github.com/repos/Sauloxd/review-apps/downloads', - events_url: 'https://api.github.com/repos/Sauloxd/review-apps/events', - fork: false, - forks: 2, - forks_count: 2, - forks_url: 'https://api.github.com/repos/Sauloxd/review-apps/forks', - full_name: 'Sauloxd/review-apps', - git_commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/commits{/sha}', - git_refs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/refs{/sha}', - git_tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/tags{/sha}', - git_url: 'git://github.com/Sauloxd/review-apps.git', - has_downloads: true, - has_issues: true, - has_pages: true, - has_projects: true, - has_wiki: true, - homepage: null, - hooks_url: 'https://api.github.com/repos/Sauloxd/review-apps/hooks', - html_url: 'https://github.com/Sauloxd/review-apps', - id: 290071259, - is_template: false, - issue_comment_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/comments{/number}', - issue_events_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/events{/number}', - issues_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues{/number}', - keys_url: 'https://api.github.com/repos/Sauloxd/review-apps/keys{/key_id}', - labels_url: 'https://api.github.com/repos/Sauloxd/review-apps/labels{/name}', - language: 'JavaScript', - languages_url: 'https://api.github.com/repos/Sauloxd/review-apps/languages', - license: { - key: 'mit', - name: 'MIT License', - node_id: 'MDc6TGljZW5zZTEz', - spdx_id: 'MIT', - url: 'https://api.github.com/licenses/mit', - }, - merges_url: 'https://api.github.com/repos/Sauloxd/review-apps/merges', - milestones_url: 'https://api.github.com/repos/Sauloxd/review-apps/milestones{/number}', - mirror_url: null, - name: 'review-apps', - node_id: 'MDEwOlJlcG9zaXRvcnkyOTAwNzEyNTk=', - notifications_url: 'https://api.github.com/repos/Sauloxd/review-apps/notifications{?since,all,participating}', - open_issues: 4, - open_issues_count: 4, - owner: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - private: false, - pulls_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls{/number}', - pushed_at: '2021-12-26T16:38:42Z', - releases_url: 'https://api.github.com/repos/Sauloxd/review-apps/releases{/id}', - size: 9440, - ssh_url: 'git@github.com:Sauloxd/review-apps.git', - stargazers_count: 5, - stargazers_url: 'https://api.github.com/repos/Sauloxd/review-apps/stargazers', - statuses_url: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/{sha}', - subscribers_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscribers', - subscription_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscription', - svn_url: 'https://github.com/Sauloxd/review-apps', - tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/tags', - teams_url: 'https://api.github.com/repos/Sauloxd/review-apps/teams', - topics: [], - trees_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/trees{/sha}', - updated_at: '2021-12-26T13:08:42Z', - url: 'https://api.github.com/repos/Sauloxd/review-apps', - visibility: 'public', - watchers: 5, - watchers_count: 5, - }, - sha: '0ec72fcac8533f44d76be97b78777fe2ad9fb1c9', - user: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - }, - body: null, - changed_files: 5, - closed_at: null, - comments: 0, - comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/14/comments', - commits: 3, - commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14/commits', - created_at: '2021-12-26T13:12:19Z', - deletions: 5, - diff_url: 'https://github.com/Sauloxd/review-apps/pull/14.diff', - draft: false, - head: { - label: 'Sauloxd:issue-8/branch/with/nested/names', - ref: 'issue-8/branch/with/nested/names', - repo: { - allow_auto_merge: false, - allow_forking: true, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - allow_update_branch: false, - archive_url: 'https://api.github.com/repos/Sauloxd/review-apps/{archive_format}{/ref}', - archived: false, - assignees_url: 'https://api.github.com/repos/Sauloxd/review-apps/assignees{/user}', - blobs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/blobs{/sha}', - branches_url: 'https://api.github.com/repos/Sauloxd/review-apps/branches{/branch}', - clone_url: 'https://github.com/Sauloxd/review-apps.git', - collaborators_url: 'https://api.github.com/repos/Sauloxd/review-apps/collaborators{/collaborator}', - comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/comments{/number}', - commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/commits{/sha}', - compare_url: 'https://api.github.com/repos/Sauloxd/review-apps/compare/{base}...{head}', - contents_url: 'https://api.github.com/repos/Sauloxd/review-apps/contents/{+path}', - contributors_url: 'https://api.github.com/repos/Sauloxd/review-apps/contributors', - created_at: '2020-08-25T00:29:31Z', - default_branch: 'main', - delete_branch_on_merge: false, - deployments_url: 'https://api.github.com/repos/Sauloxd/review-apps/deployments', - description: null, - disabled: false, - downloads_url: 'https://api.github.com/repos/Sauloxd/review-apps/downloads', - events_url: 'https://api.github.com/repos/Sauloxd/review-apps/events', - fork: false, - forks: 2, - forks_count: 2, - forks_url: 'https://api.github.com/repos/Sauloxd/review-apps/forks', - full_name: 'Sauloxd/review-apps', - git_commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/commits{/sha}', - git_refs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/refs{/sha}', - git_tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/tags{/sha}', - git_url: 'git://github.com/Sauloxd/review-apps.git', - has_downloads: true, - has_issues: true, - has_pages: true, - has_projects: true, - has_wiki: true, - homepage: null, - hooks_url: 'https://api.github.com/repos/Sauloxd/review-apps/hooks', - html_url: 'https://github.com/Sauloxd/review-apps', - id: 290071259, - is_template: false, - issue_comment_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/comments{/number}', - issue_events_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/events{/number}', - issues_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues{/number}', - keys_url: 'https://api.github.com/repos/Sauloxd/review-apps/keys{/key_id}', - labels_url: 'https://api.github.com/repos/Sauloxd/review-apps/labels{/name}', - language: 'JavaScript', - languages_url: 'https://api.github.com/repos/Sauloxd/review-apps/languages', - license: { - key: 'mit', - name: 'MIT License', - node_id: 'MDc6TGljZW5zZTEz', - spdx_id: 'MIT', - url: 'https://api.github.com/licenses/mit', - }, - merges_url: 'https://api.github.com/repos/Sauloxd/review-apps/merges', - milestones_url: 'https://api.github.com/repos/Sauloxd/review-apps/milestones{/number}', - mirror_url: null, - name: 'review-apps', - node_id: 'MDEwOlJlcG9zaXRvcnkyOTAwNzEyNTk=', - notifications_url: 'https://api.github.com/repos/Sauloxd/review-apps/notifications{?since,all,participating}', - open_issues: 4, - open_issues_count: 4, - owner: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - private: false, - pulls_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls{/number}', - pushed_at: '2021-12-26T16:38:42Z', - releases_url: 'https://api.github.com/repos/Sauloxd/review-apps/releases{/id}', - size: 9440, - ssh_url: 'git@github.com:Sauloxd/review-apps.git', - stargazers_count: 5, - stargazers_url: 'https://api.github.com/repos/Sauloxd/review-apps/stargazers', - statuses_url: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/{sha}', - subscribers_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscribers', - subscription_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscription', - svn_url: 'https://github.com/Sauloxd/review-apps', - tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/tags', - teams_url: 'https://api.github.com/repos/Sauloxd/review-apps/teams', - topics: [], - trees_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/trees{/sha}', - updated_at: '2021-12-26T13:08:42Z', - url: 'https://api.github.com/repos/Sauloxd/review-apps', - visibility: 'public', - watchers: 5, - watchers_count: 5, - }, - sha: '9839dbff11685875100adea8fdbe065bf5517fa7', - user: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - }, - html_url: 'https://github.com/Sauloxd/review-apps/pull/14', - id: 810015035, - issue_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/14', - labels: [], - locked: false, - maintainer_can_modify: false, - merge_commit_sha: '9d8c7a45b75c511b2f952ae197954f9445625568', - mergeable: null, - mergeable_state: 'unknown', - merged: false, - merged_at: null, - merged_by: null, - milestone: null, - node_id: 'PR_kwDOEUoi284wR9k7', - number: 14, - patch_url: 'https://github.com/Sauloxd/review-apps/pull/14.patch', - rebaseable: null, - requested_reviewers: [], - requested_teams: [], - review_comment_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/comments{/number}', - review_comments: 0, - review_comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14/comments', - state: 'open', - statuses_url: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/9839dbff11685875100adea8fdbe065bf5517fa7', - title: '[Issue 8] Nested branch names', - updated_at: '2021-12-26T16:38:44Z', - url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls/14', - user: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - }, - repository: { - allow_forking: true, - archive_url: 'https://api.github.com/repos/Sauloxd/review-apps/{archive_format}{/ref}', - archived: false, - assignees_url: 'https://api.github.com/repos/Sauloxd/review-apps/assignees{/user}', - blobs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/blobs{/sha}', - branches_url: 'https://api.github.com/repos/Sauloxd/review-apps/branches{/branch}', - clone_url: 'https://github.com/Sauloxd/review-apps.git', - collaborators_url: 'https://api.github.com/repos/Sauloxd/review-apps/collaborators{/collaborator}', - comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/comments{/number}', - commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/commits{/sha}', - compare_url: 'https://api.github.com/repos/Sauloxd/review-apps/compare/{base}...{head}', - contents_url: 'https://api.github.com/repos/Sauloxd/review-apps/contents/{+path}', - contributors_url: 'https://api.github.com/repos/Sauloxd/review-apps/contributors', - created_at: '2020-08-25T00:29:31Z', - default_branch: 'main', - deployments_url: 'https://api.github.com/repos/Sauloxd/review-apps/deployments', - description: null, - disabled: false, - downloads_url: 'https://api.github.com/repos/Sauloxd/review-apps/downloads', - events_url: 'https://api.github.com/repos/Sauloxd/review-apps/events', - fork: false, - forks: 2, - forks_count: 2, - forks_url: 'https://api.github.com/repos/Sauloxd/review-apps/forks', - full_name: 'Sauloxd/review-apps', - git_commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/commits{/sha}', - git_refs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/refs{/sha}', - git_tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/tags{/sha}', - git_url: 'git://github.com/Sauloxd/review-apps.git', - has_downloads: true, - has_issues: true, - has_pages: true, - has_projects: true, - has_wiki: true, - homepage: null, - hooks_url: 'https://api.github.com/repos/Sauloxd/review-apps/hooks', - html_url: 'https://github.com/Sauloxd/review-apps', - id: 290071259, - is_template: false, - issue_comment_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/comments{/number}', - issue_events_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/events{/number}', - issues_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues{/number}', - keys_url: 'https://api.github.com/repos/Sauloxd/review-apps/keys{/key_id}', - labels_url: 'https://api.github.com/repos/Sauloxd/review-apps/labels{/name}', - language: 'JavaScript', - languages_url: 'https://api.github.com/repos/Sauloxd/review-apps/languages', - license: { - key: 'mit', - name: 'MIT License', - node_id: 'MDc6TGljZW5zZTEz', - spdx_id: 'MIT', - url: 'https://api.github.com/licenses/mit', - }, - merges_url: 'https://api.github.com/repos/Sauloxd/review-apps/merges', - milestones_url: 'https://api.github.com/repos/Sauloxd/review-apps/milestones{/number}', - mirror_url: null, - name: 'review-apps', - node_id: 'MDEwOlJlcG9zaXRvcnkyOTAwNzEyNTk=', - notifications_url: 'https://api.github.com/repos/Sauloxd/review-apps/notifications{?since,all,participating}', - open_issues: 4, - open_issues_count: 4, - owner: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - private: false, - pulls_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls{/number}', - pushed_at: '2021-12-26T16:38:42Z', - releases_url: 'https://api.github.com/repos/Sauloxd/review-apps/releases{/id}', - size: 9440, - ssh_url: 'git@github.com:Sauloxd/review-apps.git', - stargazers_count: 5, - stargazers_url: 'https://api.github.com/repos/Sauloxd/review-apps/stargazers', - statuses_url: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/{sha}', - subscribers_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscribers', - subscription_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscription', - svn_url: 'https://github.com/Sauloxd/review-apps', - tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/tags', - teams_url: 'https://api.github.com/repos/Sauloxd/review-apps/teams', - topics: [], - trees_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/trees{/sha}', - updated_at: '2021-12-26T13:08:42Z', - url: 'https://api.github.com/repos/Sauloxd/review-apps', - visibility: 'public', - watchers: 5, - watchers_count: 5, - }, - sender: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, -}; diff --git a/packages/action/dist/spec/fixtures/on-push-github.js b/packages/action/dist/spec/fixtures/on-push-github.js deleted file mode 100644 index a03802b..0000000 --- a/packages/action/dist/spec/fixtures/on-push-github.js +++ /dev/null @@ -1,200 +0,0 @@ -"use strict"; -// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#push -Object.defineProperty(exports, "__esModule", { value: true }); -exports.onPushGithubFixture = void 0; -exports.onPushGithubFixture = { - context: { - payload: { - after: '8ee87144dc29b2d7e713d42aa97deb477137f7dd', - base_ref: null, - before: '64115ba22d01fe905b8ac623866707692f5ec6ee', - commits: [ - { - author: { - email: 'saulotoshi@gmail.com', - name: 'sauloxd', - username: 'Sauloxd', - }, - committer: { - email: 'saulotoshi@gmail.com', - name: 'sauloxd', - username: 'Sauloxd', - }, - distinct: true, - id: '8ee87144dc29b2d7e713d42aa97deb477137f7dd', - message: 'log github', - timestamp: '2021-12-26T14:21:46-03:00', - tree_id: '6c69cca3bf53774cb781b2cfbb12301814ddec28', - url: 'https://github.com/Sauloxd/review-apps/commit/8ee87144dc29b2d7e713d42aa97deb477137f7dd', - }, - ], - compare: 'https://github.com/Sauloxd/review-apps/compare/64115ba22d01...8ee87144dc29', - created: false, - deleted: false, - forced: false, - head_commit: { - author: { - email: 'saulotoshi@gmail.com', - name: 'sauloxd', - username: 'Sauloxd', - }, - committer: { - email: 'saulotoshi@gmail.com', - name: 'sauloxd', - username: 'Sauloxd', - }, - distinct: true, - id: '8ee87144dc29b2d7e713d42aa97deb477137f7dd', - message: 'log github', - timestamp: '2021-12-26T14:21:46-03:00', - tree_id: '6c69cca3bf53774cb781b2cfbb12301814ddec28', - url: 'https://github.com/Sauloxd/review-apps/commit/8ee87144dc29b2d7e713d42aa97deb477137f7dd', - }, - pusher: { - email: 'saulotoshi@gmail.com', - name: 'Sauloxd', - }, - ref: 'refs/heads/issue-8/branch/with/nested/names', - repository: { - allow_forking: true, - archive_url: 'https://api.github.com/repos/Sauloxd/review-apps/{archive_format}{/ref}', - archived: false, - assignees_url: 'https://api.github.com/repos/Sauloxd/review-apps/assignees{/user}', - blobs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/blobs{/sha}', - branches_url: 'https://api.github.com/repos/Sauloxd/review-apps/branches{/branch}', - clone_url: 'https://github.com/Sauloxd/review-apps.git', - collaborators_url: 'https://api.github.com/repos/Sauloxd/review-apps/collaborators{/collaborator}', - comments_url: 'https://api.github.com/repos/Sauloxd/review-apps/comments{/number}', - commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/commits{/sha}', - compare_url: 'https://api.github.com/repos/Sauloxd/review-apps/compare/{base}...{head}', - contents_url: 'https://api.github.com/repos/Sauloxd/review-apps/contents/{+path}', - contributors_url: 'https://api.github.com/repos/Sauloxd/review-apps/contributors', - created_at: 1598315371, - default_branch: 'main', - deployments_url: 'https://api.github.com/repos/Sauloxd/review-apps/deployments', - description: null, - disabled: false, - downloads_url: 'https://api.github.com/repos/Sauloxd/review-apps/downloads', - events_url: 'https://api.github.com/repos/Sauloxd/review-apps/events', - fork: false, - forks: 2, - forks_count: 2, - forks_url: 'https://api.github.com/repos/Sauloxd/review-apps/forks', - full_name: 'Sauloxd/review-apps', - git_commits_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/commits{/sha}', - git_refs_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/refs{/sha}', - git_tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/tags{/sha}', - git_url: 'git://github.com/Sauloxd/review-apps.git', - has_downloads: true, - has_issues: true, - has_pages: true, - has_projects: true, - has_wiki: true, - homepage: null, - hooks_url: 'https://api.github.com/repos/Sauloxd/review-apps/hooks', - html_url: 'https://github.com/Sauloxd/review-apps', - id: 290071259, - is_template: false, - issue_comment_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/comments{/number}', - issue_events_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues/events{/number}', - issues_url: 'https://api.github.com/repos/Sauloxd/review-apps/issues{/number}', - keys_url: 'https://api.github.com/repos/Sauloxd/review-apps/keys{/key_id}', - labels_url: 'https://api.github.com/repos/Sauloxd/review-apps/labels{/name}', - language: 'JavaScript', - languages_url: 'https://api.github.com/repos/Sauloxd/review-apps/languages', - license: { - key: 'mit', - name: 'MIT License', - node_id: 'MDc6TGljZW5zZTEz', - spdx_id: 'MIT', - url: 'https://api.github.com/licenses/mit', - }, - master_branch: 'main', - merges_url: 'https://api.github.com/repos/Sauloxd/review-apps/merges', - milestones_url: 'https://api.github.com/repos/Sauloxd/review-apps/milestones{/number}', - mirror_url: null, - name: 'review-apps', - node_id: 'MDEwOlJlcG9zaXRvcnkyOTAwNzEyNTk=', - notifications_url: 'https://api.github.com/repos/Sauloxd/review-apps/notifications{?since,all,participating}', - open_issues: 4, - open_issues_count: 4, - owner: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - email: 'saulotoshi@gmail.com', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - name: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - private: false, - pulls_url: 'https://api.github.com/repos/Sauloxd/review-apps/pulls{/number}', - pushed_at: 1640539313, - releases_url: 'https://api.github.com/repos/Sauloxd/review-apps/releases{/id}', - size: 9440, - ssh_url: 'git@github.com:Sauloxd/review-apps.git', - stargazers: 5, - stargazers_count: 5, - stargazers_url: 'https://api.github.com/repos/Sauloxd/review-apps/stargazers', - statuses_url: 'https://api.github.com/repos/Sauloxd/review-apps/statuses/{sha}', - subscribers_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscribers', - subscription_url: 'https://api.github.com/repos/Sauloxd/review-apps/subscription', - svn_url: 'https://github.com/Sauloxd/review-apps', - tags_url: 'https://api.github.com/repos/Sauloxd/review-apps/tags', - teams_url: 'https://api.github.com/repos/Sauloxd/review-apps/teams', - topics: [], - trees_url: 'https://api.github.com/repos/Sauloxd/review-apps/git/trees{/sha}', - updated_at: '2021-12-26T13:08:42Z', - url: 'https://github.com/Sauloxd/review-apps', - visibility: 'public', - watchers: 5, - watchers_count: 5, - }, - sender: { - avatar_url: 'https://avatars.githubusercontent.com/u/11878589?v=4', - events_url: 'https://api.github.com/users/Sauloxd/events{/privacy}', - followers_url: 'https://api.github.com/users/Sauloxd/followers', - following_url: 'https://api.github.com/users/Sauloxd/following{/other_user}', - gists_url: 'https://api.github.com/users/Sauloxd/gists{/gist_id}', - gravatar_id: '', - html_url: 'https://github.com/Sauloxd', - id: 11878589, - login: 'Sauloxd', - node_id: 'MDQ6VXNlcjExODc4NTg5', - organizations_url: 'https://api.github.com/users/Sauloxd/orgs', - received_events_url: 'https://api.github.com/users/Sauloxd/received_events', - repos_url: 'https://api.github.com/users/Sauloxd/repos', - site_admin: false, - starred_url: 'https://api.github.com/users/Sauloxd/starred{/owner}{/repo}', - subscriptions_url: 'https://api.github.com/users/Sauloxd/subscriptions', - type: 'User', - url: 'https://api.github.com/users/Sauloxd', - }, - }, - eventName: 'push', - sha: '8ee87144dc29b2d7e713d42aa97deb477137f7dd', - ref: 'refs/heads/issue-8/branch/with/nested/names', - workflow: 'Workflow to help develop this action', - action: '__self', - actor: 'Sauloxd', - job: 'develop', - runNumber: 65, - runId: 1624576651, - apiUrl: 'https://api.github.com', - serverUrl: 'https://github.com', - graphqlUrl: 'https://api.github.com/graphql', - }, -}; diff --git a/packages/action/dist/spec/template/default/index.js b/packages/action/dist/spec/template/default/index.js deleted file mode 100644 index cbca632..0000000 --- a/packages/action/dist/spec/template/default/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const http = __importStar(require("http")); -const default_1 = require("../../../src/template/default"); -const manifest_1 = require("../../fixtures/manifest"); -// To develop, run yarn dev:tmpl -const server = http.createServer((_req, res) => { - res.writeHead(200, { 'content-type': 'text/html' }); - res.end((0, default_1.defaultPage)(manifest_1.manifest)); -}); -server.listen(process.env.PORT || 3000); diff --git a/packages/action/dist/src/template/default/components/body/body.html b/packages/action/dist/template/default/components/body/body.html similarity index 100% rename from packages/action/dist/src/template/default/components/body/body.html rename to packages/action/dist/template/default/components/body/body.html diff --git a/packages/action/dist/src/template/default/components/body/body.js b/packages/action/dist/template/default/components/body/body.js similarity index 100% rename from packages/action/dist/src/template/default/components/body/body.js rename to packages/action/dist/template/default/components/body/body.js diff --git a/packages/action/dist/src/template/default/components/card/card.html b/packages/action/dist/template/default/components/card/card.html similarity index 100% rename from packages/action/dist/src/template/default/components/card/card.html rename to packages/action/dist/template/default/components/card/card.html diff --git a/packages/action/dist/src/template/default/components/card/card.js b/packages/action/dist/template/default/components/card/card.js similarity index 100% rename from packages/action/dist/src/template/default/components/card/card.js rename to packages/action/dist/template/default/components/card/card.js diff --git a/packages/action/dist/src/template/default/components/review-app-list/review-app-list.html b/packages/action/dist/template/default/components/review-app-list/review-app-list.html similarity index 100% rename from packages/action/dist/src/template/default/components/review-app-list/review-app-list.html rename to packages/action/dist/template/default/components/review-app-list/review-app-list.html diff --git a/packages/action/dist/src/template/default/components/review-app-list/review-app-list.js b/packages/action/dist/template/default/components/review-app-list/review-app-list.js similarity index 100% rename from packages/action/dist/src/template/default/components/review-app-list/review-app-list.js rename to packages/action/dist/template/default/components/review-app-list/review-app-list.js diff --git a/packages/action/dist/src/template/default/index.js b/packages/action/dist/template/default/index.js similarity index 100% rename from packages/action/dist/src/template/default/index.js rename to packages/action/dist/template/default/index.js diff --git a/packages/action/dist/src/template/default/layout.html b/packages/action/dist/template/default/layout.html similarity index 100% rename from packages/action/dist/src/template/default/layout.html rename to packages/action/dist/template/default/layout.html diff --git a/packages/action/dist/src/template/default/layout.js b/packages/action/dist/template/default/layout.js similarity index 100% rename from packages/action/dist/src/template/default/layout.js rename to packages/action/dist/template/default/layout.js diff --git a/packages/action/dist/src/template/default/to-html.js b/packages/action/dist/template/default/to-html.js similarity index 100% rename from packages/action/dist/src/template/default/to-html.js rename to packages/action/dist/template/default/to-html.js diff --git a/packages/action/dist/src/utils/file-manager.js b/packages/action/dist/utils/file-manager.js similarity index 100% rename from packages/action/dist/src/utils/file-manager.js rename to packages/action/dist/utils/file-manager.js diff --git a/packages/action/dist/src/utils/git.js b/packages/action/dist/utils/git.js similarity index 100% rename from packages/action/dist/src/utils/git.js rename to packages/action/dist/utils/git.js diff --git a/packages/action/dist/src/utils/log-error.js b/packages/action/dist/utils/log-error.js similarity index 100% rename from packages/action/dist/src/utils/log-error.js rename to packages/action/dist/utils/log-error.js diff --git a/packages/action/dist/src/utils/manifest.js b/packages/action/dist/utils/manifest.js similarity index 100% rename from packages/action/dist/src/utils/manifest.js rename to packages/action/dist/utils/manifest.js diff --git a/packages/action/dist/src/utils/retry.js b/packages/action/dist/utils/retry.js similarity index 100% rename from packages/action/dist/src/utils/retry.js rename to packages/action/dist/utils/retry.js diff --git a/packages/action/dist/src/utils/user-input.js b/packages/action/dist/utils/user-input.js similarity index 100% rename from packages/action/dist/src/utils/user-input.js rename to packages/action/dist/utils/user-input.js diff --git a/packages/action/package.json b/packages/action/package.json index c36b0cf..8db3fbf 100644 --- a/packages/action/package.json +++ b/packages/action/package.json @@ -1,12 +1,12 @@ { "name": "@sxd/review-apps-action", "version": "0.0.1", - "main": "dist/src/index.js", + "main": "dist/index.js", "scripts": { "build": "yarn build:clean && yarn build:ts && yarn build:html", "build:clean": "rimraf dist", "build:ts": "tsc -p tsconfig.json", - "build:html": "yarn copyfiles \"src/**/*.html\" dist", + "build:html": "yarn copyfiles -u 1 \"src/**/*.html\" dist", "dev:tmpl": "nodemon -e ts,tsx spec/template/default/index.ts" }, "dependencies": { diff --git a/packages/action/src/event-handlers/on-pull-request/params.ts b/packages/action/src/event-handlers/on-pull-request/params.ts index 69f3085..9ef162c 100644 --- a/packages/action/src/event-handlers/on-pull-request/params.ts +++ b/packages/action/src/event-handlers/on-pull-request/params.ts @@ -1,9 +1,8 @@ import * as github from '@actions/github'; -import { GithubPullRequestPayload } from '../../../spec/fixtures/on-pull-request'; import { PullRequestAction, SanitizedPayloadParams } from '../../interface'; export function getParams(): SanitizedPayloadParams { - const payload: GithubPullRequestPayload = github.context.payload as any; + const payload = github.context.payload as any; return { action: payload.action as PullRequestAction, diff --git a/packages/action/src/event-handlers/on-push/params.ts b/packages/action/src/event-handlers/on-push/params.ts index 29b1501..24d55e5 100644 --- a/packages/action/src/event-handlers/on-push/params.ts +++ b/packages/action/src/event-handlers/on-push/params.ts @@ -1,9 +1,8 @@ import * as github from '@actions/github'; -import { GithubPushPayload } from '../../../spec/fixtures/on-push-github'; import { SanitizedPayloadParams } from '../../interface'; export function getParams(): SanitizedPayloadParams { - const payload: GithubPushPayload = github.context.payload as any; + const payload = github.context.payload as any; return { repository: { diff --git a/packages/action/src/services/sync-app.ts b/packages/action/src/services/sync-app.ts index c52d0f0..88595a9 100644 --- a/packages/action/src/services/sync-app.ts +++ b/packages/action/src/services/sync-app.ts @@ -12,30 +12,19 @@ import { userInput } from '../utils/user-input'; export const syncApp = withError(async function syncApp( params: SanitizedPayloadParams ) { - const paths = fileManager.paths(params); const input = userInput(); - const PUBLIC_URL = `/${paths.byRepo}/${paths.byHeadCommit}`; + const paths = fileManager.paths(params); core.info(` - -> Paths: -> Your app will be hosted in github pages: + -> "https://${params.repository.owner}.github.io/${params.repository.name}" + + -> This app is served from: -> "https://${params.repository.owner}.github.io/${params.repository.name}/${paths.byHeadCommit}" - -> We'll build your app with the proper PUBLIC_URL: ${PUBLIC_URL} - -> For more info: - -> https://github.com/facebook/create-react-app/pull/937/files#diff-9b26877ecf8d15b7987c96e5a17502f6 - -> https://www.gatsbyjs.com/docs/path-prefix/ `); - core.info(` - -> Building app - `); - - await git.hardReset(params.branch.name); - - core.exportVariable('PUBLIC_URL', PUBLIC_URL); - - await exec(input.buildCmd); + await optionalBuildApp(params); core.info(` -> Current working branch: ${params.branch.name}" @@ -71,3 +60,31 @@ async function updateApp(params: SanitizedPayloadParams) { await git.commit(`Updating app ${paths.byHeadCommit}`); await git.push(input.branch); } + +async function optionalBuildApp(params: SanitizedPayloadParams) { + const input = userInput(); + + if (!input.buildCmd) { + core.info('-> NO "buildCmd" passed, skipping build phase'); + + return; + } + const paths = fileManager.paths(params); + const PUBLIC_URL = `/${paths.byRepo}/${paths.byHeadCommit}`; + + core.info(` + -> BUILDING APP + + -> We'll build your app with the proper PUBLIC_URL: ${PUBLIC_URL} + -> That way you can use relative links inside your app. + -> For more info: + -> https://github.com/facebook/create-react-app/pull/937/files#diff-9b26877ecf8d15b7987c96e5a17502f6 + -> https://www.gatsbyjs.com/docs/path-prefix/ + `); + + await git.hardReset(params.branch.name); + + core.exportVariable('PUBLIC_URL', PUBLIC_URL); + + await exec(input.buildCmd); +} diff --git a/packages/action/tsconfig.json b/packages/action/tsconfig.json index 2bc49e6..34cc0d6 100644 --- a/packages/action/tsconfig.json +++ b/packages/action/tsconfig.json @@ -2,9 +2,11 @@ "compilerOptions": { "target": "es6", "module": "CommonJS", + "rootDir": "./src", "outDir": "dist", "strict": true, "noImplicitAny": false, "esModuleInterop": true - } + }, + "include": ["./src/**/*"], } From 8286ae00b380170c79d5902338af59c12241faf7 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 17:45:15 -0300 Subject: [PATCH 2/8] target correct index.js --- action.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2444189..33d824b 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ description: | runs: using: 'node16' - main: 'packages/action/dist/src/index.js' + main: 'packages/action/dist/index.js' inputs: build-cmd: diff --git a/package.json b/package.json index c64aa91..dfa60da 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ ], "private": "true", "version": "0.0.1", - "main": "packages/action/dist/src/index.js", + "main": "packages/action/dist/index.js", "repository": "git@github.com:Sauloxd/review-apps.git", "author": "sauloxd ", "license": "MIT", From b39cee18808ff364c59ab271d74d7f3660ac4f49 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 17:50:46 -0300 Subject: [PATCH 3/8] Skip husky in build step --- packages/action/dist/utils/git.js | 2 +- packages/action/src/utils/git.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/action/dist/utils/git.js b/packages/action/dist/utils/git.js index 4157282..b19ca56 100644 --- a/packages/action/dist/utils/git.js +++ b/packages/action/dist/utils/git.js @@ -40,7 +40,7 @@ exports.stageChanges = (0, log_error_1.withError)(function stageChanges(...files }); exports.commit = (0, log_error_1.withError)(function commit(message) { return __awaiter(this, void 0, void 0, function* () { - yield (0, exec_1.exec)('git', ['commit', '-m', decorateMessage(message)]); + yield (0, exec_1.exec)('git', ['commit', '--no-verify', '-m', decorateMessage(message)]); }); }); exports.push = (0, log_error_1.withError)(function push(branch) { diff --git a/packages/action/src/utils/git.ts b/packages/action/src/utils/git.ts index 8742b45..86feaf8 100644 --- a/packages/action/src/utils/git.ts +++ b/packages/action/src/utils/git.ts @@ -34,7 +34,7 @@ export const stageChanges = withError(async function stageChanges( }); export const commit = withError(async function commit(message: string) { - await exec('git', ['commit', '-m', decorateMessage(message)]); + await exec('git', ['commit', '--no-verify', '-m', decorateMessage(message)]); }); export const push = withError(async function push(branch: string) { From 58851f4d8bea6c6440e31bbedeb474e459f4cb4d Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 18:02:51 -0300 Subject: [PATCH 4/8] test if workflow works without buildcmd --- .github/workflows/for-testing-this-project.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/for-testing-this-project.yml b/.github/workflows/for-testing-this-project.yml index 2f84b50..9a9c833 100644 --- a/.github/workflows/for-testing-this-project.yml +++ b/.github/workflows/for-testing-this-project.yml @@ -1,8 +1,11 @@ name: 'Workflow to help develop this action' on: # https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request - pull_request: - types: [labeled, unlabeled, opened, edited, closed, synchronize] + # pull_request: + # types: [labeled, unlabeled, opened, edited, closed, synchronize] + push: + branches: + - issue-** jobs: develop: @@ -30,7 +33,7 @@ jobs: - name: Building create-react-app example uses: ./ # Replace here with sauloxd/review-apps@X.X.X with: - build-cmd: 'yarn run cra:build' + # build-cmd: 'yarn run cra:build' branch: 'review-apps' dist: 'packages/cra-example/build' slug: 'dev-cra' From 0af8017e9ede3bb68f9b2cc652c01e6110079310 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 18:05:04 -0300 Subject: [PATCH 5/8] remove default build-cmd --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index 33d824b..49febdf 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,6 @@ inputs: For example, if you use "create-react-app", this would be "yarn build". IMPORTANT: If your app doesn't use HashRouting (the #/ in url), use process.env.PUBLIC_URL to correctly configure it. See FAQ and https://www.gatsbyjs.com/docs/path-prefix/ for more info. - default: 'yarn build' branch: description: | From e59e4cba657570241885d70a512058c579e4d3f4 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 18:06:26 -0300 Subject: [PATCH 6/8] improve copy --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index 49febdf..7c9733d 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,8 @@ inputs: For example, if you use "create-react-app", this would be "yarn build". IMPORTANT: If your app doesn't use HashRouting (the #/ in url), use process.env.PUBLIC_URL to correctly configure it. See FAQ and https://www.gatsbyjs.com/docs/path-prefix/ for more info. + Also you can skip building your apps if you did it in a previous step. + Remember that the "dist" path should be pointing to your app's build branch: description: | From b7916aaf54c3c1ec4089fc38cc43d8c8d25f10aa Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 18:10:42 -0300 Subject: [PATCH 7/8] fix copy --- packages/action/dist/services/sync-app.js | 4 +++- packages/action/src/services/sync-app.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/action/dist/services/sync-app.js b/packages/action/dist/services/sync-app.js index 15a3a7f..df64f4f 100644 --- a/packages/action/dist/services/sync-app.js +++ b/packages/action/dist/services/sync-app.js @@ -85,7 +85,9 @@ function optionalBuildApp(params) { return __awaiter(this, void 0, void 0, function* () { const input = (0, user_input_1.userInput)(); if (!input.buildCmd) { - core.info('-> NO "buildCmd" passed, skipping build phase'); + core.info(` + -> NO "buildCmd" passed, skipping build phase + `); return; } const paths = fileManager.paths(params); diff --git a/packages/action/src/services/sync-app.ts b/packages/action/src/services/sync-app.ts index 88595a9..3dd0378 100644 --- a/packages/action/src/services/sync-app.ts +++ b/packages/action/src/services/sync-app.ts @@ -65,7 +65,9 @@ async function optionalBuildApp(params: SanitizedPayloadParams) { const input = userInput(); if (!input.buildCmd) { - core.info('-> NO "buildCmd" passed, skipping build phase'); + core.info(` + -> NO "buildCmd" passed, skipping build phase + `); return; } From 7906c6980c63e1ad185b2f8ddbc9be3a749790b5 Mon Sep 17 00:00:00 2001 From: sauloxd Date: Tue, 28 Dec 2021 18:12:29 -0300 Subject: [PATCH 8/8] fix --- .../workflows/for-testing-this-project.yml | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/for-testing-this-project.yml b/.github/workflows/for-testing-this-project.yml index 9a9c833..b1eb16c 100644 --- a/.github/workflows/for-testing-this-project.yml +++ b/.github/workflows/for-testing-this-project.yml @@ -1,11 +1,11 @@ name: 'Workflow to help develop this action' on: # https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request - # pull_request: - # types: [labeled, unlabeled, opened, edited, closed, synchronize] - push: - branches: - - issue-** + pull_request: + types: [labeled, unlabeled, opened, edited, closed, synchronize] + # push: + # branches: + # - issue-** jobs: develop: @@ -27,31 +27,33 @@ jobs: - name: Install deps checking cache hit run: yarn install --frozen-lockfile + # Use this action to SSH to github action machine. # - name: Setup tmate session (ssh) # uses: mxschmitt/action-tmate@v2 + # This is how you'll use the action - name: Building create-react-app example uses: ./ # Replace here with sauloxd/review-apps@X.X.X with: - # build-cmd: 'yarn run cra:build' + build-cmd: 'yarn run cra:build' branch: 'review-apps' dist: 'packages/cra-example/build' slug: 'dev-cra' # This is how you'll use the action - # - name: Building storybook example - # uses: ./ # Replace here with sauloxd/review-apps@X.X.X - # with: - # build-cmd: 'yarn run cra:storybook' - # branch: 'review-apps' - # dist: 'packages/cra-example/storybook-static' - # slug: 'dev-cra-sb' + - name: Building storybook example + uses: ./ # Replace here with sauloxd/review-apps@X.X.X + with: + build-cmd: 'yarn run cra:storybook' + branch: 'review-apps' + dist: 'packages/cra-example/storybook-static' + slug: 'dev-cra-sb' - # # This is how you'll use the action - # - name: Building gatsby example - # uses: ./ # Replace here with sauloxd/review-apps@X.X.X - # with: - # build-cmd: 'yarn run gatsby:build' - # branch: 'review-apps' - # dist: 'packages/gatsby-example/public' - # slug: 'dev-gatsby' + # This is how you'll use the action + - name: Building gatsby example + uses: ./ # Replace here with sauloxd/review-apps@X.X.X + with: + build-cmd: 'yarn run gatsby:build' + branch: 'review-apps' + dist: 'packages/gatsby-example/public' + slug: 'dev-gatsby'