Skip to content

completed lab

completed lab #67

Workflow file for this run

name: Close PRs from forks
on:
pull_request_target:
types: [opened, synchronize]
jobs:
close-fork-pr:
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- name: Close fork PR with message
uses: actions/github-script@v8
with:
script: |
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: "Please create a new PR and choose your fork as the base repo. You've made a PR to the instructors' repo."
});
await github.rest.pulls.update({
owner,
repo,
pull_number: prNumber,
state: 'closed'
});