Skip to content

New workflow to copy linked issue labels to PRs - #11386

Merged
alamb merged 1 commit into
apache:mainfrom
Jefffrey:copy-issue-label-workflow
Oct 7, 2026
Merged

alamb merged 1 commit into
apache:mainfrom
Jefffrey:copy-issue-label-workflow

Conversation

@Jefffrey

@Jefffrey Jefffrey commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

From issue:

Our changelog generation relies on categorizing included PRs by their labels, see:

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?

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?

Tested in my fork:

Are there any significant user-facing changes?

Just dev process changes


concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
group: ${{ github.repository }}-${{ github.event.pull_request.number }}-${{ github.workflow }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was something identified by codex on the side; if PRs from different forks have same name it can cause issues, so we rely on PR number to avoid conflicts. this follows what we do in other workflows:

concurrency:
group: ${{ github.repository }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

since this runs only on PRs, we dont need a fallback to github.sha

@Jefffrey Jefffrey added the development-process Internal changes; PRs with this label are excluded from changelog label Oct 5, 2026
@Jefffrey

Jefffrey commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

reminder to self: if/once this is merged, go back to my fork and clean it up

@etseidl etseidl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jefffrey. I didn't look at each test, but I assume this works for any of the synonyms of "closes".

@alamb

alamb commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Makes sense to me -- thank you @Jefffrey and @etseidl

@alamb
alamb added this pull request to the merge queue Oct 7, 2026
Merged via the queue into apache:main with commit 2047545 Oct 7, 2026
33 checks passed
@Jefffrey
Jefffrey deleted the copy-issue-label-workflow branch October 8, 2026 02:01
@Jefffrey

Jefffrey commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Jefffrey. I didn't look at each test, but I assume this works for any of the synonyms of "closes".

it uses a github api to get those issues, so as long as github itself recognizes the issues as being linked to the PR in that way the solution will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Internal changes; PRs with this label are excluded from changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce workflow to copy labels from issue to linked PR

3 participants