Skip to content

Commit 8ede28e

Browse files
authored
Add dummy workflow triggered on comments (#468)
The end goal is to have a tool that commits a regenerated yarn.lock when we add a specific comment under a PR. This PR is a first iteration.
1 parent 7fd6d3d commit 8ede28e

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
3+
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.7.0")
4+
5+
@file:Repository("https://bindings.krzeminski.it")
6+
@file:DependsOn("actions:checkout:v6")
7+
8+
import io.github.typesafegithub.workflows.domain.RunnerType
9+
import io.github.typesafegithub.workflows.domain.triggers.IssueComment
10+
import io.github.typesafegithub.workflows.dsl.expressions.expr
11+
import io.github.typesafegithub.workflows.dsl.workflow
12+
import io.github.typesafegithub.workflows.yaml.CheckoutActionVersionSource
13+
import io.github.typesafegithub.workflows.yaml.DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG
14+
15+
workflow(
16+
name = "Build",
17+
on = listOf(
18+
IssueComment()
19+
),
20+
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
21+
checkoutActionVersion = CheckoutActionVersionSource.InferFromClasspath(),
22+
),
23+
sourceFile = __FILE__,
24+
) {
25+
job(
26+
id = "regenerate-yarn-lock",
27+
runsOn = RunnerType.UbuntuLatest,
28+
`if` = expr("!github.event.issue.pull_request")
29+
) {
30+
run(
31+
name = "Run command",
32+
command = "echo ${expr("github.event.issue_comment")}",
33+
)
34+
}
35+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file was generated using Kotlin DSL (.github/workflows/regenerate-yarn-lock.main.kts).
2+
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
3+
# Generated with https://github.com/typesafegithub/github-workflows-kt
4+
5+
name: 'Build'
6+
on:
7+
issue_comment: {}
8+
jobs:
9+
check_yaml_consistency:
10+
name: 'Check YAML consistency'
11+
runs-on: 'ubuntu-latest'
12+
steps:
13+
- id: 'step-0'
14+
name: 'Check out'
15+
uses: 'actions/checkout@v6'
16+
- id: 'step-1'
17+
name: 'Execute script'
18+
run: 'rm ''.github/workflows/regenerate-yarn-lock.yaml'' && ''.github/workflows/regenerate-yarn-lock.main.kts'''
19+
- id: 'step-2'
20+
name: 'Consistency check'
21+
run: 'git diff --exit-code ''.github/workflows/regenerate-yarn-lock.yaml'''
22+
regenerate-yarn-lock:
23+
runs-on: 'ubuntu-latest'
24+
needs:
25+
- 'check_yaml_consistency'
26+
if: '${{ !github.event.issue.pull_request }}'
27+
steps:
28+
- id: 'step-0'
29+
name: 'Run command'
30+
run: 'echo ${{ github.event.issue_comment }}'

0 commit comments

Comments
 (0)