This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-11386-36a71842b85f7d09e09a49cb7715ab73dcaa2f6d in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit 20475454f3d84a9dfd24d2a003d681c27734b613 Author: Jeffrey Vo <[email protected]> AuthorDate: Wed Oct 7 19:10:10 2026 +0000 New workflow to copy linked issue labels to PRs (#11386) # Which issue does this PR close? <!-- It is not necessary to raise an issue, but it is encouraged if it is a non-trivial enhancement/bug. If this PR relates to an existing issue, but does not fully resolve it, please change the wording below from "Closes #NNN" to "Relates to #NNN" or "Part of #NNN" to avoid false closing an issue. --> - Closes #10529 # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. Please try to explain the problem you are trying to solve in terms of the user-visible behavior, rather than the implementation. --> From issue: > Our changelog generation relies on categorizing included PRs by their labels, see: > > - https://github.com/apache/arrow-rs/pull/10451 > > That means we should ensure PRs merged to main have labels such as `bug`, `enhancement`, `performance`, `security`, `development-process`, etc. > > Whenever we create issues they usually get tagged as either bug or enhancement based on the template, so if a PR is created and links to the issue (`Closes #123`) then it would be good to be able to copy the labels from the issue to the PR so maintainers don't need to manually do this for every PR. > > Looks like this project might accomplish this: https://github.com/michalvankodev/copy-issue-labels > > Look into introducing this (and ensuring it does what we need). # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Instead of pulling in another action, just achieve it simply with actions github script. This implementation was drafted by codex and iterated to get the simplest form, then I did some further editing of the code. New workflow that runs only on PR open, and if PR closes an issue (just linking it doesnt trigger this) then it fetches labels from that issue, and if is one of the 4 whitelisted labels copies it onto the PR # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests, if so identify these tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. DO NOT simply paste a list of commands ran to verify the code; this is what our CI is for and it pollutes the PR. ONLY explain if testing was included with this PR, or why it wasn't. --> Tested in my fork: - https://github.com/Jefffrey/arrow-rs/pull/2 - https://github.com/Jefffrey/arrow-rs/pull/4 - https://github.com/Jefffrey/arrow-rs/pull/6 - https://github.com/Jefffrey/arrow-rs/pull/7 - https://github.com/Jefffrey/arrow-rs/pull/8 - https://github.com/Jefffrey/arrow-rs/pull/9 - https://github.com/Jefffrey/arrow-rs/pull/10 # Are there any significant user-facing changes? <!-- Significant user-facing changes include: - Breaking public API change - Significant change to existing functionality (e.g. function returns something different) These need to be explicitly called out to ensure we have proper documentation if required and to ensure we follow proper semantic versioning. DO NOT restate the changes of this PR; if a bug was fixed and already explained above, we don't need this to be restated as a user-facing change. --> Just dev process changes --- .github/workflows/dev_pr.yml | 45 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 573bbee786..06bd87d923 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -18,7 +18,7 @@ name: dev_pr concurrency: - group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + group: ${{ github.repository }}-${{ github.event.pull_request.number }}-${{ github.workflow }} cancel-in-progress: true # Trigger whenever a PR is changed (title as well as new / changed commits) @@ -49,3 +49,46 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/workflows/dev_pr/labeler.yml sync-labels: true + + # Copy labels from linked issue if present, to help with changelog generation. + # For simplicity we just run once on open and for first linked issue; its trivial + # for maintainers to fix up the label manually for more complex cases. + copy-issue-labels: + name: Copy labels from (first) closing issue + if: github.event.action == 'opened' + needs: process + runs-on: ubuntu-slim + permissions: + issues: read + pull-requests: write + steps: + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { node } = await github.graphql(` + query($id: ID!) { + node(id: $id) { + ... on PullRequest { + closingIssuesReferences(first: 1) { + nodes { number repository { nameWithOwner } } + } + } + } + } + `, { id: context.payload.pull_request.node_id }); + const issue = node?.closingIssuesReferences?.nodes[0]; + const repository = `${context.repo.owner}/${context.repo.repo}`.toLowerCase(); + // just in case its referencing an external repo + if (!issue || issue.repository.nameWithOwner.toLowerCase() !== repository) return; + const labels = await github.paginate(github.rest.issues.listLabelsOnIssue, { + ...context.repo, issue_number: issue.number, per_page: 100, + }); + // these ones impact changelog generation the most + const allowedLabels = ['bug', 'enhancement', 'development-process', 'performance']; + const labelsToCopy = labels.map(label => label.name).filter(name => allowedLabels.includes(name)); + if (labelsToCopy.length) { + await github.rest.issues.addLabels({ + ...context.repo, issue_number: context.issue.number, + labels: labelsToCopy, + }); + }
