ci: define permissions for contributing comment workflow #21
Workflow file for this run
This file contains 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
# SPDX-FileCopyrightText: 2021 James Hilliard <[email protected]> | |
# | |
# SPDX-License-Identifier: MIT | |
on: | |
pull_request_target: | |
types: | |
- opened | |
permissions: | |
contents: read # for reading contributing file | |
issues: write # for posting PR comment | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install pandoc | |
run: sudo apt-get install pandoc | |
- uses: actions/github-script@v5 | |
with: | |
script: | | |
const contributing = await github.rest.repos.getContent({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
path: 'doc/source/contributing.rst', | |
}) | |
options = { | |
input: Buffer.from(contributing.data.content, 'base64') | |
} | |
mdout = await exec.getExecOutput('pandoc', ['-f', 'rst', '-t', 'gfm'], options) | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: mdout.stdout | |
}) |