Skip to content

Updates for C8

Updates for C8 #43

name: UofT-DSI Main Repository PR Workflow
on:
pull_request_target:
types: [opened, synchronize]
jobs:
handle-pr:
if: github.repository_owner == 'UofT-DSI'
runs-on: ubuntu-latest
steps:
- name: Handle PR based on source branch
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const branchName = pr.head.ref;
const issue_number = pr.number;
const repo = context.repo;
if (branchName.startsWith('assignment')) {
const commentBody = `This pull request was made to the wrong repository. Please open it in your own fork instead. Refer to the [Assignment Submission Guide](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md) for detailed instructions.`;
// Comment on the PR
await github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: issue_number,
body: commentBody
});
// Close the PR
await github.rest.pulls.update({
owner: repo.owner,
repo: repo.repo,
pull_number: issue_number,
state: "closed"
});
} else {
const commentBody = `Thanks for your contribution! 🎉\n\nPlease remember to tag or request a review from the DSI team. Give us up to 72 hours to review your pull request. We appreciate your patience and efforts.`;
await github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: issue_number,
body: commentBody
});
}