Skip to content

Commit d09fbb2

Browse files
committed
feat: Add Branch Update Reminder as PR Comment
1 parent c6f3afb commit d09fbb2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,32 @@ jobs:
9797
repo: context.repo.repo,
9898
body: output
9999
})
100+
101+
- name: Alert for Forked Repositories
102+
if: github.event.pull_request.head.repo.fork == true
103+
uses: actions/github-script@v6
104+
with:
105+
github-token: ${{ secrets.GITHUB_TOKEN }}
106+
script: |
107+
const output = `
108+
## ⚠️ This PR is from a Forked Repository
109+
110+
Your branch is from a **forked repository**, and it might be outdated compared to the \`main\` branch.
111+
112+
Please make sure you have the latest updates from \`main\` before merging.
113+
114+
Run the following commands:
115+
\`\`\`sh
116+
git remote add upstream https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git
117+
git fetch upstream
118+
git merge upstream/main
119+
git push origin HEAD
120+
\`\`\`
121+
`;
122+
123+
github.rest.issues.createComment({
124+
issue_number: context.issue.number,
125+
owner: context.repo.owner,
126+
repo: context.repo.repo,
127+
body: output
128+
})

0 commit comments

Comments
 (0)