@percy/cli-build 1.31.4-beta.2 → 1.31.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,24 +86,26 @@ Usage:
86
86
  $ percy build:approve [options] <build-id>
87
87
 
88
88
  Arguments:
89
- build-id Build ID to approve
89
+ build-id Build ID to approve
90
90
 
91
91
  Options:
92
- --username <string> Username for authentication (can also be set via BROWSERSTACK_USERNAME env
93
- var)
94
- --access-key <string> Access key for authentication (can also be set via BROWSERSTACK_ACCESS_KEY
95
- env var)
92
+ --username <string> Username for authentication (can also be set via
93
+ BROWSERSTACK_USERNAME env var)
94
+ --access-key <string> Access key for authentication (can also be set via
95
+ BROWSERSTACK_ACCESS_KEY env var)
96
+ --pass-if-previously-approved Does not exit with an error if the build has previous approvals
96
97
 
97
98
  Global options:
98
- -v, --verbose Log everything
99
- -q, --quiet Log errors only
100
- -s, --silent Log nothing
101
- -l, --labels <string> Associates labels to the build (ex: --labels=dev,prod )
102
- -h, --help Display command help
99
+ -v, --verbose Log everything
100
+ -q, --quiet Log errors only
101
+ -s, --silent Log nothing
102
+ -l, --labels <string> Associates labels to the build (ex: --labels=dev,prod )
103
+ -h, --help Display command help
103
104
 
104
105
  Examples:
105
106
  $ percy build:approve <build-id>
106
107
  $ percy build:approve <build-id> --username username --access-key **key**
108
+ $ percy build:approve <build-id> --pass-if-previously-approved
107
109
  ```
108
110
 
109
111
  ### `percy build:unapprove`
package/dist/approve.js CHANGED
@@ -7,7 +7,14 @@ import { fetchCredentials, reviewCommandConfig } from './utils.js';
7
7
  */
8
8
  export const approve = command('approve', {
9
9
  description: 'Approve Percy builds',
10
- ...reviewCommandConfig
10
+ ...reviewCommandConfig,
11
+ ...{
12
+ flags: [...reviewCommandConfig.flags, {
13
+ name: 'pass-if-previously-approved',
14
+ description: 'Does not exit with an error if the build has previous approvals'
15
+ }],
16
+ examples: [...reviewCommandConfig.examples, '$0 <build-id> --pass-if-previously-approved']
17
+ }
11
18
  }, async ({
12
19
  flags,
13
20
  args,
@@ -39,6 +46,11 @@ export const approve = command('approve', {
39
46
  log.info(`Build ${args.buildId} approved successfully!`);
40
47
  log.info(`Approved by: ${approvedBy.user_name} (${approvedBy.user_email})`);
41
48
  } catch (error) {
49
+ var _error$response;
50
+ if (flags.passIfPreviouslyApproved && Array.isArray(error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.body) === null || _error$response === void 0 ? void 0 : _error$response.errors) && error.response.body.errors.some(e => e.detail.toLowerCase().includes('approve action is already performed on this build'))) {
51
+ log.info(`Build ${args.buildId} is already approved: skipping approval`);
52
+ exit(0);
53
+ }
42
54
  log.error(`Failed to approve build ${args.buildId}`);
43
55
  log.error(error);
44
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/cli-build",
3
- "version": "1.31.4-beta.2",
3
+ "version": "1.31.5-alpha.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  ]
37
37
  },
38
38
  "dependencies": {
39
- "@percy/cli-command": "1.31.4-beta.2"
39
+ "@percy/cli-command": "1.31.5-alpha.0"
40
40
  },
41
- "gitHead": "a0bd772d1d41454683a15b5c5223f7fc571f3b29"
41
+ "gitHead": "c9c7b1d09cc3568ff57f4444b732d1b3a3b65fe2"
42
42
  }