Skip to content

[manual]: Add NDA link #507

[manual]: Add NDA link

[manual]: Add NDA link #507

name: "[manual]: Add NDA link"
on:
workflow_dispatch:
inputs:
prId:
description: "Pr id"
required: true
url:
description: "Url"
required: true
jobs:
nda-link:
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "18.x"
- name: "Add link"
run: |
echo PR_ID=$PR_ID
echo URL=$URL
curl https://api.github.com/repos/ytsaurus/ytsaurus-ui/pulls/$PR_ID | jq .body | sed -E 's/<!-- nda-start -->.*<!-- nda-end -->/ /g' > body.txt
node << __EOF
const fs = require('fs')
const body = JSON.parse(fs.readFileSync('./body.txt')) || '';
fs.writeFileSync('./new-body.json', JSON.stringify({
body: [
'<!-- nda-start -->',
'$URL',
'<!-- nda-end -->' + body,
].join("\n")
}))
__EOF
curl -L -X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--data-binary @new-body.json \
https://api.github.com/repos/ytsaurus/ytsaurus-ui/pulls/$PR_ID \
env:
PR_ID: ${{ inputs.prId }}
URL: ${{ inputs.url }}