dotfiles/dot_config/nvim/dot_github/workflows/updater.yml

39 lines
1.3 KiB
YAML

name: Updater Comment
on:
pull_request_target:
paths:
- "**.lua"
- "packer_snapshot"
types:
- opened
jobs:
updater-comment:
name: Comment updater settings
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
const src = context.payload.pull_request.head
const user = src.user.login
const tab = " "
let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n`
if (src.ref != "nightly") {
settings += tab + tab + `branch = "${src.ref}",\n`
}
if (user != "AstroNvim") {
settings += tab + tab + `remote = "${user}",\n`
settings += tab + tab + `remotes = {\n`
settings += tab + tab + tab + `["${user}"] = "${user}/${src.repo.name}",\n`
settings += tab + tab + `},\n`
}
settings += tab + "},"
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Use the following `updater` settings in your `user/init.lua` file, restart, and run `:AstroUpdate` to test this pull request:\n```\n" + settings + "\n```",
})