mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
ADD a danger workflow
This commit is contained in:
parent
4694b704a0
commit
872ac612d4
@ -1,7 +1,11 @@
|
||||
import { fail, danger } from 'danger';
|
||||
import { flatten, intersection, isEmpty } from 'lodash';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const pkg = require('./package.json'); // eslint-disable-line import/newline-after-import
|
||||
execSync('npm install lodash');
|
||||
|
||||
const { flatten, intersection, isEmpty } = require('lodash');
|
||||
|
||||
const pkg = require('../../package.json'); // eslint-disable-line import/newline-after-import
|
||||
const prLogConfig = pkg['pr-log'];
|
||||
|
||||
const Versions = {
|
||||
@ -20,18 +24,11 @@ const checkRequiredLabels = labels => {
|
||||
branchVersion === Versions.PATCH ? 'feature request' : [],
|
||||
]);
|
||||
|
||||
const requiredLabels = flatten([
|
||||
prLogConfig.skipLabels || [],
|
||||
(prLogConfig.validLabels || []).map(keyVal => keyVal[0]),
|
||||
]);
|
||||
const requiredLabels = flatten([prLogConfig.skipLabels || [], (prLogConfig.validLabels || []).map(keyVal => keyVal[0])]);
|
||||
|
||||
const blockingLabels = intersection(forbiddenLabels, labels);
|
||||
if (!isEmpty(blockingLabels)) {
|
||||
fail(
|
||||
`PR is marked with ${blockingLabels.map(label => `"${label}"`).join(', ')} label${
|
||||
blockingLabels.length > 1 ? 's' : ''
|
||||
}.`
|
||||
);
|
||||
fail(`PR is marked with ${blockingLabels.map(label => `"${label}"`).join(', ')} label${blockingLabels.length > 1 ? 's' : ''}.`);
|
||||
}
|
||||
|
||||
const foundLabels = intersection(requiredLabels, labels);
|
21
.github/main.workflow
vendored
21
.github/main.workflow
vendored
@ -1,12 +1,15 @@
|
||||
workflow "New workflow" {
|
||||
on = "push"
|
||||
resolves = ["Hello World"]
|
||||
workflow "Dangerfile JS Pull" {
|
||||
on = "pull_request"
|
||||
resolves = "Danger JS"
|
||||
}
|
||||
|
||||
action "Hello World" {
|
||||
uses = "./ci/action-a"
|
||||
env = {
|
||||
MY_NAME = "Mona"
|
||||
}
|
||||
args = "\"Hello world, I'm $MY_NAME!\""
|
||||
workflow "Dangerfile JS Label" {
|
||||
on = "label"
|
||||
resolves = "Danger JS"
|
||||
}
|
||||
|
||||
action "Danger JS" {
|
||||
uses = "danger/danger-js@master"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
args = "--dangerfile .ci/danger/dangerfile.ts"
|
||||
}
|
@ -21,7 +21,6 @@ object Project : Project({
|
||||
buildType(OpenSourceProjects_Storybook_Bootstrap)
|
||||
buildType(OpenSourceProjects_Storybook_CliTestLatestCra)
|
||||
buildType(OpenSourceProjects_Storybook_Examples)
|
||||
buildType(OpenSourceProjects_Storybook_Danger)
|
||||
buildType(OpenSourceProjects_Storybook_NativeSmokeTests)
|
||||
buildType(OpenSourceProjects_Storybook_Docs)
|
||||
buildType(OpenSourceProjects_Storybook_Build_2)
|
||||
|
@ -1,79 +0,0 @@
|
||||
package OpenSourceProjects_Storybook.buildTypes
|
||||
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.buildFeatures.commitStatusPublisher
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.vcs
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.retryBuild
|
||||
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.VcsTrigger
|
||||
|
||||
object OpenSourceProjects_Storybook_Danger : BuildType({
|
||||
uuid = "759f0116-2f7d-4c03-8220-56e4ab03be3a"
|
||||
id = "OpenSourceProjects_Storybook_Danger"
|
||||
name = "Danger"
|
||||
|
||||
params {
|
||||
password("env.DANGER_GITHUB_API_TOKEN", "credentialsJSON:9ac87388-d267-4def-a10e-3e596369f644")
|
||||
param("env.PULL_REQUEST_URL", "https://github.com/storybooks/storybook/%teamcity.build.branch%")
|
||||
}
|
||||
|
||||
vcs {
|
||||
root(OpenSourceProjects_Storybook.vcsRoots.OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1)
|
||||
|
||||
buildDefaultBranch = false
|
||||
}
|
||||
|
||||
steps {
|
||||
script {
|
||||
name = "Danger"
|
||||
scriptContent = """
|
||||
#!/bin/sh
|
||||
|
||||
set -e -x
|
||||
|
||||
yarn
|
||||
yarn danger ci
|
||||
""".trimIndent()
|
||||
dockerImage = "node:%docker.node.version%"
|
||||
}
|
||||
}
|
||||
|
||||
triggers {
|
||||
vcs {
|
||||
quietPeriodMode = VcsTrigger.QuietPeriodMode.USE_DEFAULT
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:master
|
||||
""".trimIndent()
|
||||
}
|
||||
retryBuild {
|
||||
delaySeconds = 3600
|
||||
}
|
||||
}
|
||||
|
||||
features {
|
||||
commitStatusPublisher {
|
||||
publisher = github {
|
||||
githubUrl = "https://api.github.com"
|
||||
authType = personalToken {
|
||||
token = "credentialsJSON:5ffe2d7e-531e-4f6f-b1fc-a41bfea26eaa"
|
||||
}
|
||||
}
|
||||
param("github_oauth_user", "Hypnosphi")
|
||||
}
|
||||
feature {
|
||||
type = "pullRequests"
|
||||
param("filterAuthorRole", "EVERYBODY")
|
||||
param("authenticationType", "token")
|
||||
param("secure:accessToken", "credentialsJSON:5ffe2d7e-531e-4f6f-b1fc-a41bfea26eaa")
|
||||
}
|
||||
}
|
||||
|
||||
requirements {
|
||||
doesNotContain("env.OS", "Windows")
|
||||
}
|
||||
|
||||
cleanup {
|
||||
artifacts(days = 1)
|
||||
}
|
||||
})
|
@ -1,13 +0,0 @@
|
||||
FROM debian:9.5-slim
|
||||
|
||||
LABEL "com.github.actions.name"="Hello World"
|
||||
LABEL "com.github.actions.description"="Write arguments to the standard output"
|
||||
LABEL "com.github.actions.icon"="mic"
|
||||
LABEL "com.github.actions.color"="purple"
|
||||
|
||||
LABEL "repository"="http://github.com/storybooks/storybook"
|
||||
LABEL "homepage"="http://github.com/storybooks"
|
||||
LABEL "maintainer"="Norbert de Langen <ndelangen@me.com>"
|
||||
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh -l
|
||||
|
||||
sh -c "echo $*"
|
Loading…
x
Reference in New Issue
Block a user