-
Notifications
You must be signed in to change notification settings - Fork 113
Added Workflow for Sync in issue and PR #602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This workflow synchronizes metadata from linked issues into the pull request body, including labels, assignees, and milestones.
@Adez017 is attempting to deploy a commit to the recode Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs. In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊 Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv. We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰 🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨ 📚Your perks for contribution to this community 👇🏻
If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a GitHub workflow to automatically synchronize metadata (labels, assignees, and milestones) from linked issues into pull request descriptions. The workflow is triggered when PRs are opened, edited, or synchronized.
Key changes:
- Added automated workflow to parse issue references in PR bodies
- Implemented metadata extraction and synchronization from linked issues
- Added PR body updates with formatted metadata blocks
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.github/workflows/pr-issue-sync.yml
Outdated
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const issues = JSON.parse(core.getInput("issues")); |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script attempts to read input 'issues' but it was set as an output in the previous step. This should be steps.extract.outputs.issues
instead of core.getInput('issues')
.
const issues = JSON.parse(core.getInput("issues")); | |
const issues = JSON.parse(inputs.issues); |
Copilot uses AI. Check for mistakes.
.github/workflows/pr-issue-sync.yml
Outdated
let newBody = pr.body || ""; | ||
|
||
// Remove old metadata block if exists | ||
newBody = newBody.replace(/---\n### Synced Metadata[\s\S]*$/, ""); |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern searches for 'Synced Metadata' but the actual header being created is 'Synced data from Linked Issues' (line 67). This will result in duplicate metadata blocks being appended instead of replacing the existing one.
newBody = newBody.replace(/---\n### Synced Metadata[\s\S]*$/, ""); | |
newBody = newBody.replace(/---\n### Synced data from Linked Issues[\s\S]*$/, ""); |
Copilot uses AI. Check for mistakes.
.github/workflows/pr-issue-sync.yml
Outdated
|
||
const metadataBlock = | ||
`\n---\n` + | ||
`### Synced data from Linked Issues\n\n` + |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are extra spaces between '###' and 'Synced' which creates non-standard markdown formatting. This should be '### Synced data from Linked Issues' with a single space.
Copilot uses AI. Check for mistakes.
As the Forked doesn't have the permission it will fail here , to test the functionality we need to use hit and trial . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const issuesInput = core.getInput("issues") || "[]"; |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script tries to get input 'issues' but it should use the output from the previous step. Use steps.extract.outputs.issues
instead of core.getInput('issues')
.
const issuesInput = core.getInput("issues") || "[]"; | |
const issuesInput = process.env.ISSUES || "[]"; |
Copilot uses AI. Check for mistakes.
with: | ||
script: | | ||
const body = context.payload.pull_request.body || ""; | ||
const issuePattern = /#(\d+)/g; |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern will match any '#' followed by digits, potentially capturing false positives like '#123' in code snippets or unrelated contexts. Consider using a more specific pattern that looks for common issue linking phrases like 'fixes #123', 'closes #123', or 'resolves #123'.
const issuePattern = /#(\d+)/g; | |
const issuePattern = /\b(?:fixe?s|close[sd]?|resolve[sd]?)[:\s]+#(\d+)/gi; |
Copilot uses AI. Check for mistakes.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
secret with a PAT . have you used this @Adez017 |
No @sanjay-kv |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const issuesInput = core.getInput("issues") || "[]"; |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core.getInput("issues")
call will not retrieve the output from the previous step. It should be steps.extract.outputs.issues
to access the output from the extract step.
const issuesInput = core.getInput("issues") || "[]"; | |
const issuesInput = steps.extract.outputs.issues || "[]"; |
Copilot uses AI. Check for mistakes.
with: | ||
script: | | ||
const body = context.payload.pull_request.body || ""; | ||
const issuePattern = /#(\d+)/g; |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern /#(\d+)/g
will match any #number
format, but GitHub's issue linking requires specific keywords like 'fixes', 'closes', 'resolves' followed by the issue number. This could incorrectly match unrelated hash numbers in the PR body.
const issuePattern = /#(\d+)/g; | |
// Match "fixes #123", "closes: #456", "resolves #789", etc. (case-insensitive) | |
const issuePattern = /\b(?:fixe?[sd]?|close[sd]?|resolve[sd]?)\s*[: ]+\s*#(\d+)/gi; |
Copilot uses AI. Check for mistakes.
mail or anything else ? |
No my qn was have you used PAT taken for this , if yes which one. Is it the one i sent you before via mail? @Adez017 |
No i directly used the secrets.GIT_TOKEN which is used in other workflows |
Description
This workflow synchronizes metadata from linked issues into the pull request body, including labels, assignees, and milestones.
Fixes #600
Type of Change
Changes Made
Added file for pr-issue-sync.yml
Dependencies
Checklist
npm run build
and attached screenshot(s) in this PR.