Skip to content

Commit e328be7

Browse files
✨ Add support for IPv6 via WARP
Old PR: upptime/upptime#904
1 parent eb5f383 commit e328be7

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/helpers/workflows.ts

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { getOctokit } from "./github";
21
import { getConfig } from "./config";
32
import {
43
DEFAULT_RUNNER,
@@ -10,6 +9,7 @@ import {
109
UPDATES_CI_SCHEDULE,
1110
UPTIME_CI_SCHEDULE,
1211
} from "./constants";
12+
import { getOctokit } from "./github";
1313

1414
let release: string | undefined = undefined;
1515
export const getUptimeMonitorVersion = async () => {
@@ -24,8 +24,7 @@ export const getUptimeMonitorVersion = async () => {
2424
return release;
2525
};
2626

27-
const introComment =
28-
async () => `# This file was generated by upptime/uptime-monitor@${await getUptimeMonitorVersion()}
27+
const introComment = async () => `# This file was generated by upptime/uptime-monitor@${await getUptimeMonitorVersion()}
2928
#
3029
# ===============================
3130
# Do not edit this file directly!
@@ -66,6 +65,11 @@ jobs:
6665
`;
6766
};
6867

68+
const getHasIpV6Site = async (): Promise<boolean> => {
69+
const config = await getConfig();
70+
return !!config.sites.find((site) => site.ipv6);
71+
};
72+
6973
export const responseTimeCiWorkflow = async () => {
7074
const config = await getConfig();
7175
const workflowSchedule = config.workflowSchedule || {};
@@ -88,7 +92,13 @@ jobs:
8892
uses: actions/checkout@v3
8993
with:
9094
ref: \${{ github.head_ref }}
91-
token: \${{ secrets.GH_PAT || github.token }}
95+
token: \${{ secrets.GH_PAT || github.token }}${
96+
(await getHasIpV6Site())
97+
? `
98+
- name: Setup WARP
99+
uses: fscarmen/warp-on-actions@v2`
100+
: ""
101+
}
92102
- name: Update response time
93103
uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()}
94104
with:
@@ -101,7 +111,6 @@ jobs:
101111

102112
export const setupCiWorkflow = async () => {
103113
const config = await getConfig();
104-
const workflowSchedule = config.workflowSchedule || {};
105114
const commitMessages = config.commitMessages || {};
106115
const statusWebsite = config["status-website"] || {};
107116

@@ -130,7 +139,13 @@ jobs:
130139
with:
131140
command: "update-template"
132141
env:
133-
GH_PAT: \${{ secrets.GH_PAT || github.token }}
142+
GH_PAT: \${{ secrets.GH_PAT || github.token }}${
143+
(await getHasIpV6Site())
144+
? `
145+
- name: Setup WARP
146+
uses: fscarmen/warp-on-actions@v2`
147+
: ""
148+
}
134149
- name: Update response time
135150
uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()}
136151
with:

0 commit comments

Comments
 (0)