diff --git a/Project.toml b/Project.toml index 246a0586..eac163e8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.11" +version = "0.7.12" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/plugins/tagbot.jl b/src/plugins/tagbot.jl index 350d9b2c..2404e746 100644 --- a/src/plugins/tagbot.jl +++ b/src/plugins/tagbot.jl @@ -2,7 +2,7 @@ TagBot(; file="$(contractuser(default_file("github", "workflows", "TagBot.yml")))", destination="TagBot.yml", - cron="0 0 * * *", + trigger="JuliaTagBot", token=Secret("GITHUB_TOKEN"), ssh=Secret("DOCUMENTER_KEY"), ssh_password=nothing, @@ -21,7 +21,7 @@ Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagB ## Keyword Arguments - `file::AbstractString`: Template file for the workflow file. - `destination::AbstractString`: Destination of the workflow file, relative to `.github/workflows`. -- `cron::AbstractString`: Cron expression for the schedule interval. +- `trigger::AbstractString`: Username of the trigger user for custom regsitries. - `token::Secret`: Name of the token secret to use. - `ssh::Secret`: Name of the SSH private key secret to use. - `ssh_password::Secret`: Name of the SSH key password secret to use. @@ -37,7 +37,7 @@ Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagB @plugin struct TagBot <: FilePlugin file::String = default_file("github", "workflows", "TagBot.yml") destination::String = "TagBot.yml" - cron::String = "0 0 * * *" + trigger::String = "JuliaTagBot" token::Secret = Secret("GITHUB_TOKEN") ssh::Union{Secret, Nothing} = Secret("DOCUMENTER_KEY") ssh_password::Union{Secret, Nothing} = nothing @@ -68,7 +68,7 @@ function view(p::TagBot, ::Template, ::AbstractString) "BRANCHES" => p.branches === nothing ? nothing : string(p.branches), "CHANGELOG" => changelog, "CHANGELOG_IGNORE" => ignore, - "CRON" => p.cron, + "TRIGGER" => p.trigger, "DISPATCH" => p.dispatch === nothing ? nothing : string(p.dispatch), "DISPATCH_DELAY" => p.dispatch_delay, "GPG" => p.gpg, diff --git a/templates/github/workflows/TagBot.yml b/templates/github/workflows/TagBot.yml index 733f2820..464b9ea4 100644 --- a/templates/github/workflows/TagBot.yml +++ b/templates/github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: {{{CRON}}} + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == '{{{TRIGGER}}}' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/fixtures/AllPlugins/.github/workflows/TagBot.yml b/test/fixtures/AllPlugins/.github/workflows/TagBot.yml index e72d6452..f49313b6 100644 --- a/test/fixtures/AllPlugins/.github/workflows/TagBot.yml +++ b/test/fixtures/AllPlugins/.github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: 0 0 * * * + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/fixtures/Basic/.github/workflows/TagBot.yml b/test/fixtures/Basic/.github/workflows/TagBot.yml index e72d6452..f49313b6 100644 --- a/test/fixtures/Basic/.github/workflows/TagBot.yml +++ b/test/fixtures/Basic/.github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: 0 0 * * * + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml index e72d6452..f49313b6 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: 0 0 * * * + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml b/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml index e72d6452..f49313b6 100644 --- a/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml +++ b/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: 0 0 * * * + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml index d78283af..c6aa1ae3 100644 --- a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml +++ b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml @@ -1,10 +1,12 @@ name: TagBot on: - schedule: - - cron: 0 0 */3 * * + issue_comment: + types: + - created workflow_dispatch: jobs: TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'OtherUser' runs-on: ubuntu-latest steps: - uses: JuliaRegistries/TagBot@v1 diff --git a/test/reference.jl b/test/reference.jl index 3d67d8c2..be061005 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -128,7 +128,7 @@ end ProjectFile(; version=v"1"), Readme(; inline_badges=true), TagBot(; - cron="0 0 */3 * *", + trigger="OtherUser", token=Secret("MYTOKEN"), ssh=Secret("SSHKEY"), ssh_password=Secret("SSHPASS"), diff --git a/test/show.jl b/test/show.jl index cb1db43a..90fffada 100644 --- a/test/show.jl +++ b/test/show.jl @@ -59,7 +59,7 @@ end TagBot: file: "$(joinpath(TEMPLATES_DIR, "github", "workflows", "TagBot.yml"))" destination: "TagBot.yml" - cron: "0 0 * * *" + trigger: "JuliaTagBot" token: Secret("GITHUB_TOKEN") ssh: Secret("DOCUMENTER_KEY") ssh_password: nothing