-
Notifications
You must be signed in to change notification settings - Fork 138
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,84 @@ | ||||||||
| name: Sync PR Metadata from Linked Issues | ||||||||
|
|
||||||||
| on: | ||||||||
| pull_request: | ||||||||
| types: [opened, edited, synchronize] | ||||||||
|
|
||||||||
| jobs: | ||||||||
| sync-metadata: | ||||||||
| runs-on: ubuntu-latest | ||||||||
|
|
||||||||
| permissions: | ||||||||
| pull-requests: write | ||||||||
| issues: read | ||||||||
| contents: read | ||||||||
|
|
||||||||
| steps: | ||||||||
| - name: Extract Linked Issues | ||||||||
| id: extract | ||||||||
| uses: actions/github-script@v7 | ||||||||
| with: | ||||||||
| script: | | ||||||||
| const body = context.payload.pull_request.body || ""; | ||||||||
| const issuePattern = /#(\d+)/g; | ||||||||
|
||||||||
| 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; |
Outdated
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); |
Outdated
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.
Outdated
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]*$/, ""); |
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'.