Fix pasting multi-line text into the commit description #2010
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}.`) |