Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Aug 5, 2024
0 parents commit 389518c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/mirror-canonical-repository.main.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env kotlin

@file:Repository("https://repo.maven.apache.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:2.3.0")

import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
import io.github.typesafegithub.workflows.domain.triggers.Cron
import io.github.typesafegithub.workflows.domain.triggers.Push
import io.github.typesafegithub.workflows.domain.triggers.RepositoryDispatch
import io.github.typesafegithub.workflows.domain.triggers.Schedule
import io.github.typesafegithub.workflows.domain.triggers.WorkflowDispatch
import io.github.typesafegithub.workflows.dsl.expressions.expr
import io.github.typesafegithub.workflows.dsl.workflow

workflow(
name = "Mirror Canonical Repository",
on = listOf(
Push(),
RepositoryDispatch(),
Schedule(triggers = listOf(Cron(minute = "44"))),
WorkflowDispatch()
),
sourceFile = __FILE__
) {
job(
id = "mirror_repository",
name = "Mirror Repository",
runsOn = UbuntuLatest
) {
run(
name = "Clone Canonical Repository",
command = "git clone --bare git://git.code.sf.net/p/jedit/jEdit.bak ."
)
run(
name = "Push To Mirror Repository",
command = "git push --mirror https://x:${expr { github.token }}@github.com/${expr { github.repository }}"
)
}
}
37 changes: 37 additions & 0 deletions .github/workflows/mirror-canonical-repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file was generated using Kotlin DSL (.github/workflows/mirror-canonical-repository.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: 'Mirror Canonical Repository'
on:
push: {}
repository_dispatch: {}
schedule:
- cron: '44 * * * *'
workflow_dispatch: {}
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/mirror-canonical-repository.yaml'' && ''.github/workflows/mirror-canonical-repository.main.kts'''
- id: 'step-2'
name: 'Consistency check'
run: 'git diff --exit-code ''.github/workflows/mirror-canonical-repository.yaml'''
mirror_repository:
name: 'Mirror Repository'
runs-on: 'ubuntu-latest'
needs:
- 'check_yaml_consistency'
steps:
- id: 'step-0'
name: 'Clone Canonical Repository'
run: 'git clone --bare git://git.code.sf.net/p/jedit/jEdit.bak .'
- id: 'step-1'
name: 'Push To Mirror Repository'
run: 'git push --mirror https://x:${{ github.token }}@github.com/${{ github.repository }}'

0 comments on commit 389518c

Please sign in to comment.