mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
Allow closing issues via github actions
This provides some basic admin permissions without needing to go all the way up to a collaborator.
This commit is contained in:
parent
2b43f5b592
commit
b353d2a55a
1 changed files with 39 additions and 0 deletions
39
.github/workflows/close-issues.yml
vendored
Normal file
39
.github/workflows/close-issues.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
name: Close Issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
close_issue:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event.issue.pull_request == null && startsWith(github.event.comment.body, '/close') }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const trustedUsers = ['ChrisMcD1', 'jesseduffield', 'stefanhaller']
|
||||||
|
const commenter = context.payload.comment.user.login
|
||||||
|
|
||||||
|
console.log(`Commenter: ${commenter}`)
|
||||||
|
|
||||||
|
if (!trustedUsers.includes(commenter)) {
|
||||||
|
console.log(`User ${commenter} is not trusted. Ignoring.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const issueNumber = context.payload.issue.number
|
||||||
|
const owner = context.repo.owner
|
||||||
|
const repo = context.repo.repo
|
||||||
|
|
||||||
|
await github.rest.issues.update({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
state: 'closed'
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(`Closed issue #${issueNumber} by request from ${commenter}.`)
|
Loading…
Add table
Add a link
Reference in a new issue