Skip to content

feat(OverflowTooltipText): add new component #326

feat(OverflowTooltipText): add new component

feat(OverflowTooltipText): add new component #326

name: Update PR Description
on:
pull_request:
types: [opened]
branches:
- main
jobs:
update-description:
runs-on: ubuntu-latest
steps:
- name: Update PR Description
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const branchName = context.payload.pull_request.head.ref;
const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const { data: prData } = await github.rest.pulls.get({
owner: owner,
repo: repo,
pull_number: prNumber
});
let body = prData.body;
const issueNumberMatch = branchName.match(/feature\/(\d+)/);
const issueNumber = issueNumberMatch ? issueNumberMatch[1] : '';
if (issueNumber) {
body = prData.body.replace(/{issue-number}/g, issueNumber);
}
const branchNameCropped = branchName.split('feature/')[1];
body = prData.body.replace(/{branch-name}/g, branchNameCropped);
await github.rest.pulls.update({
owner: owner,
repo: repo,
pull_number: prNumber,
body: body
});