Skip to content

Commit

Permalink
Update TagBot for issue comment triggers (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-dG authored Oct 29, 2020
1 parent 925fcdb commit a95ba4d
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/tagbot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions templates/github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures/AllPlugins/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures/Basic/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures/WackyOptions/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

2 comments on commit a95ba4d

@christopher-dG
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:
The TagBot plugin has been updated to use issue comments instead of cron triggers.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/23871

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.12 -m "<description of version>" a95ba4d37e6a7863f2d3659a3133786d7e1c6206
git push origin v0.7.12

Please sign in to comment.