-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env kotlin | ||
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.7.0") | ||
|
||
import io.github.typesafegithub.workflows.domain.RunnerType | ||
import io.github.typesafegithub.workflows.dsl.workflow | ||
import io.github.typesafegithub.workflows.domain.triggers.Push | ||
import io.github.typesafegithub.workflows.yaml.writeToFile | ||
|
||
workflow( | ||
name = "Update metadata", | ||
sourceFile = __FILE__.toPath(), | ||
on = listOf(Push(branches = listOf("main", "generate-metadata"))), | ||
) { | ||
job( | ||
id = "generate", | ||
runsOn = RunnerType.UbuntuLatest, | ||
) { | ||
run( | ||
name = "Configure git", | ||
command = """ | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]" | ||
""".trimIndent() | ||
) | ||
run( | ||
name = "Run generation logic", | ||
command = "scripts/updateMetadata.main.kts", | ||
) | ||
run( | ||
name = "Push new commit", | ||
command = "git push", | ||
) | ||
} | ||
}.writeToFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This file was generated using Kotlin DSL (.github/workflows/update-metadata.main.kts). | ||
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | ||
# Generated with https://github.com/typesafegithub/github-workflows-kt | ||
|
||
name: 'Update metadata' | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'generate-metadata' | ||
jobs: | ||
check_yaml_consistency: | ||
name: 'Check YAML consistency' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Execute script' | ||
run: 'rm ''.github/workflows/update-metadata.yaml'' && ''.github/workflows/update-metadata.main.kts''' | ||
- id: 'step-2' | ||
name: 'Consistency check' | ||
run: 'git diff --exit-code ''.github/workflows/update-metadata.yaml''' | ||
generate: | ||
runs-on: 'ubuntu-latest' | ||
needs: | ||
- 'check_yaml_consistency' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Configure git' | ||
run: |- | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]" | ||
- id: 'step-1' | ||
name: 'Run generation logic' | ||
run: 'scripts/updateMetadata.main.kts' | ||
- id: 'step-2' | ||
name: 'Push new commit' | ||
run: 'git push' |