Skip to content

ci: define permissions for contributing comment workflow #21

ci: define permissions for contributing comment workflow

ci: define permissions for contributing comment workflow #21

Workflow file for this run

# 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
})