WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

workflow to add raw.githack link to pull requests #3

workflow to add raw.githack link to pull requests

workflow to add raw.githack link to pull requests #3

Workflow file for this run

name: Update PR Description
on:
pull_request:
types: [opened, synchronize]
jobs:
update-description:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up GitHub token
run: echo "GH_TOKEN=${{ secrets.GH_TOKEN }}" >> $GITHUB_ENV
- name: Update PR description
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
const owner = context.payload.pull_request.head.repo.owner.login;
const repo = context.payload.pull_request.head.repo.name;
const commit = context.payload.pull_request.head.sha;
const link = `https://raw.githack.com/${owner}/${repo}/${commit}/kitchen-sink.html`;
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
if (!pullRequest.body.includes(link)) {
const updatedBody = `${pullRequest.body}\n\n[View the changes](${link})`;
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
body: updatedBody,
});
}