Skip to content

Commit a346182

Browse files
authored
fix(woodpecker): update woodpecker env vars (#322)
Co-authored-by: Matt Travi <[email protected]> BREAKING CHANGE: users of Woodpecker CI earlier than v1.0.0 will no longer be properly detected. Please upgrade to a modern, supported version of Woodpecker CI
1 parent 483de89 commit a346182

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

services/woodpecker.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ export default {
55
return env.CI && env.CI === "woodpecker";
66
},
77
configuration({ env }) {
8-
const isPr = env.CI_BUILD_EVENT === "pull_request";
8+
const isPr = env.CI_PIPELINE_EVENT === "pull_request";
99

1010
return {
1111
name: "Woodpecker CI",
1212
service: "woodpecker",
1313
commit: env.CI_COMMIT_SHA,
1414
tag: env.CI_COMMIT_TAG,
15-
build: env.CI_BUILD_NUMBER,
16-
buildUrl: env.CI_BUILD_LINK,
15+
build: env.CI_PIPELINE_NUMBER,
16+
buildUrl: env.CI_PIPELINE_URL,
1717
branch: isPr ? env.CI_COMMIT_TARGET_BRANCH : env.CI_COMMIT_BRANCH,
18-
job: env.CI_JOB_NUMBER,
19-
jobUrl: env.CI_BUILD_LINK,
18+
job: env.CI_STEP_NUMBER,
19+
jobUrl: env.CI_STEP_URL,
2020
pr: env.CI_COMMIT_PULL_REQUEST,
2121
isPr,
2222
prBranch: isPr ? env.CI_COMMIT_SOURCE_BRANCH : undefined,

test/services/woodpecker.test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import woodpecker from "../../services/woodpecker.js";
33

44
const env = {
55
CI: "woodpecker",
6-
CI_JOB_NUMBER: "1234",
7-
CI_BUILD_LINK: "https://woodpecker-ci.example.com/owner/repo/91011",
6+
CI_STEP_NUMBER: "1234",
7+
CI_STEP_URL: "https://woodpecker-ci.example.com/owner/repo/91011/1234",
8+
CI_PIPELINE_URL: "https://woodpecker-ci.example.com/owner/repo/91011",
89
CI_COMMIT_SHA: "5678",
910
CI_COMMIT_TAG: "tag_name",
10-
CI_BUILD_NUMBER: "91011",
11+
CI_PIPELINE_NUMBER: "91011",
1112
CI_COMMIT_BRANCH: "main",
1213
CI_REPO_OWNER: "owner",
1314
CI_REPO_NAME: "repo",
@@ -24,7 +25,7 @@ test("Push", (t) => {
2425
buildUrl: "https://woodpecker-ci.example.com/owner/repo/91011",
2526
branch: "main",
2627
job: "1234",
27-
jobUrl: "https://woodpecker-ci.example.com/owner/repo/91011",
28+
jobUrl: "https://woodpecker-ci.example.com/owner/repo/91011/1234",
2829
pr: undefined,
2930
isPr: false,
3031
prBranch: undefined,
@@ -39,7 +40,7 @@ test("PR", (t) => {
3940
env: {
4041
...env,
4142
CI_COMMIT_PULL_REQUEST: "10",
42-
CI_BUILD_EVENT: "pull_request",
43+
CI_PIPELINE_EVENT: "pull_request",
4344
CI_COMMIT_TARGET_BRANCH: "main",
4445
CI_COMMIT_SOURCE_BRANCH: "pr-branch",
4546
},
@@ -53,7 +54,7 @@ test("PR", (t) => {
5354
buildUrl: "https://woodpecker-ci.example.com/owner/repo/91011",
5455
branch: "main",
5556
job: "1234",
56-
jobUrl: "https://woodpecker-ci.example.com/owner/repo/91011",
57+
jobUrl: "https://woodpecker-ci.example.com/owner/repo/91011/1234",
5758
pr: "10",
5859
isPr: true,
5960
prBranch: "pr-branch",

0 commit comments

Comments
 (0)