1 | /*
|
2 | * Copyright © 2018 Atomist, Inc.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 |
|
17 | import { PushTest } from "@atomist/sdm";
|
18 |
|
19 | /**
|
20 | * Is this SDM in local mode?
|
21 | * Invoked on client startup.
|
22 | */
|
23 | export function isInLocalMode(): boolean {
|
24 | return process.env.ATOMIST_MODE === "local";
|
25 | }
|
26 |
|
27 | /**
|
28 | * Is this SDM running in local mode?
|
29 | */
|
30 | export const IsInLocalMode: PushTest = {
|
31 | name: "IsInLocalMode",
|
32 | mapping: async () => isInLocalMode(),
|
33 | };
|
34 |
|
35 | /**
|
36 | * Is this SDM running as a GitHub action?
|
37 | * Invoked on client startup.
|
38 | */
|
39 | export function isGitHubAction(): boolean {
|
40 | return !!process.env.GITHUB_WORKFLOW && !!process.env.GITHUB_ACTION && !!process.env.GITHUB_WORKSPACE;
|
41 | }
|
42 |
|
43 | /**
|
44 | * Is this SDM running as a GitHub action?
|
45 | */
|
46 | export const IsGitHubAction: PushTest = {
|
47 | name: "IsGitHubAction",
|
48 | mapping: async () => isGitHubAction(),
|
49 | };
|