@unitedstatespowersquadrons/components 1.3.13 → 1.3.14

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.
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
- import { github, shields } from "../remotes";
2
+ import { shields } from "../remotes";
3
3
  import { badgeify } from "../helpers";
4
4
  import { CheckConclusion, CheckStatus } from "../types";
5
5
 
6
6
  interface Props {
7
- repo?: string | undefined;
8
7
  label: string;
9
8
  status: CheckStatus;
10
9
  conclusion?: CheckConclusion | undefined;
@@ -12,7 +11,7 @@ interface Props {
12
11
  }
13
12
 
14
13
  const CheckBadge = (props: Props) => {
15
- const { conclusion, label, repo, skipCi, status } = props;
14
+ const { conclusion, label, skipCi, status } = props;
16
15
 
17
16
  const suiteBadgeColor = () => {
18
17
  if (skipCi) return "lightgray";
@@ -65,12 +64,7 @@ const CheckBadge = (props: Props) => {
65
64
  };
66
65
  const color = suiteBadgeColor();
67
66
 
68
- const img =
69
- <img src={`${shields}/badge/${badgeify(label)}-${description() || "Unknown"}-${color}?logo=github`} />;
70
-
71
- if (!repo || conclusion === "success") return img;
72
-
73
- return <a href={`${github}/${repo}/actions/workflows/main.yml`} rel="noreferrer" target="_blank">{img}</a>;
67
+ return <img src={`${shields}/badge/${badgeify(label)}-${description() || "Unknown"}-${color}?logo=github`} />;
74
68
  };
75
69
 
76
70
  export default CheckBadge;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import Check from "./Check";
3
+ import { github } from "../remotes";
3
4
  import { CheckRun } from "../types";
4
5
 
5
6
  interface Props {
@@ -12,11 +13,15 @@ const RunBadge = (props: Props) => {
12
13
 
13
14
  if (!run || !run.status) return null;
14
15
 
15
- const { conclusion, name, status } = run;
16
+ const { conclusion, id, name, status } = run;
16
17
 
17
18
  const skipCi = false;
18
19
 
19
- return <Check conclusion={conclusion} label={name} repo={repo} skipCi={skipCi} status={status} />;
20
+ const badge = <Check conclusion={conclusion} label={name} skipCi={skipCi} status={status} />;
21
+
22
+ if (!repo || conclusion === "success") return badge;
23
+
24
+ return <a href={`${github}/${repo}/runs/${id}`} rel="noreferrer" target="_blank">{badge}</a>;
20
25
  };
21
26
 
22
27
  export default RunBadge;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import Check from "./Check";
3
+ import { github } from "../remotes";
3
4
  import { CheckSuite } from "../types";
4
5
 
5
6
  interface Props {
@@ -14,7 +15,13 @@ const SuiteBadge = (props: Props) => {
14
15
 
15
16
  const { headBranch, conclusion, skipCi, status } = suite;
16
17
 
17
- return <Check conclusion={conclusion} label={headBranch} repo={repo} skipCi={skipCi} status={status} />;
18
+ const badge = <Check conclusion={conclusion} label={headBranch} skipCi={skipCi} status={status} />;
19
+
20
+ if (!repo || conclusion === "success") return badge;
21
+
22
+ return (
23
+ <a href={`${github}/${repo}/actions?query=branch:${headBranch}`} rel="noreferrer" target="_blank">{badge}</a>
24
+ );
18
25
  };
19
26
 
20
27
  export default SuiteBadge;
package/Badges/types.ts CHANGED
@@ -44,6 +44,7 @@ interface Person {
44
44
  }
45
45
 
46
46
  export interface CheckRun {
47
+ id: number;
47
48
  name: string;
48
49
  status: CheckStatus;
49
50
  conclusion?: CheckConclusion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {