Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Copy labels from linked issues to their linked PRs #10

Merged
merged 1 commit into from
Jul 30, 2020

Conversation

mbestavros
Copy link
Contributor

@mbestavros mbestavros commented Jul 16, 2020

This PR adds an action to copy labels from linked issues to their PRs.

Resolves #12.

@mbestavros mbestavros changed the title Move project cards next to PRs they are linked to Move issue cards next to PRs they are linked to Jul 16, 2020
@mbestavros mbestavros force-pushed the linked-issue-actions branch 2 times, most recently from 0917aa7 to 44e804d Compare July 16, 2020 17:17
@mbestavros mbestavros changed the title Move issue cards next to PRs they are linked to Organize issues and PRs when they are linked Jul 16, 2020
@mbestavros mbestavros added this to Triage in Planning Jul 16, 2020
@mbestavros mbestavros force-pushed the linked-issue-actions branch 2 times, most recently from 2aa9a33 to af86a98 Compare July 16, 2020 17:38
Copy link
Contributor

@npmccallum npmccallum left a comment

Choose a reason for hiding this comment

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

  1. This is very good, very fast work. I did not expect this today!

  2. Filtering on linked:issue is smart.

  3. We probably need to separate out label-mirroring and column-moving into separate jobs. The reason for this is that we want to mirror the labels before we triage. Which means the PR isn't on the Sprint board yet. Conversely, we only want to do column moving on the Sprint board. That means we'll need different queries.

  4. We currently have an allowlist for label copying. I'm thinking we should move to a denylist.

  5. Part of me wonders if there isn't a better way to do issue linking. I'm going to look into this.

  6. I just had a crazy idea. If the first step of our bot is to set up a local, caching http proxy, we could probably minimize the number of API calls we do per hour without modifying actions. We could also probably give the proxy the token and nobody else.

@mbestavros mbestavros force-pushed the linked-issue-actions branch 3 times, most recently from c5761eb to 1467c58 Compare July 16, 2020 18:24
@mbestavros mbestavros marked this pull request as ready for review July 16, 2020 18:27
@mbestavros mbestavros force-pushed the linked-issue-actions branch 2 times, most recently from 9ceed0f to 0ffd6a9 Compare July 16, 2020 18:46
@enarxbot enarxbot added this to Reviewing in Sprint Jul 16, 2020
@mbestavros mbestavros force-pushed the linked-issue-actions branch 9 times, most recently from 0919594 to 50e28e2 Compare July 17, 2020 13:32
@mbestavros mbestavros force-pushed the linked-issue-actions branch 2 times, most recently from 44234a7 to 3aa8f55 Compare July 17, 2020 13:46
Copy link
Contributor

@npmccallum npmccallum left a comment

Choose a reason for hiding this comment

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

@mbestavros Can we get our output for this PR in the same format as #41 ?

org/repo#n: +added_label existing_label +other_added_label

@mbestavros mbestavros force-pushed the linked-issue-actions branch 2 times, most recently from e87f87c to 4c7f683 Compare July 29, 2020 19:56

# If there are any labels we need to add, add them.
if len(unset_labels) > 0:
print(f"Copying labels from issue {repo.name}#{issue.number} to PR {repo.name}#{pr.number}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(f"Copying labels from issue {repo.name}#{issue.number} to PR {repo.name}#{pr.number}")

@enarxbot enarxbot assigned mbestavros and unassigned npmccallum Jul 29, 2020
print(f"{repo.name}#{pr.number}:", end="")
for label in sorted(to_set):
state = "" if label in pr_labels else "+"
print(f" {state}{label}", end="")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(f" {state}{label}", end="")
print(f" {state}'{label}'", end="")

Copy link
Contributor

Choose a reason for hiding this comment

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

Without the above fix, you can't tell if +intel sgx is +'intel sgx' or +'intel' 'sgx'.

# Get all issue numbers related to a PR.
def get_related_issues(pr):
# Regex to pick out closing keywords.
regex = re.compile("(close[sd]?|fix|fixe[sd]?|resolve[sd]?)\s*:?\s+#(\d+)", re.I)

Choose a reason for hiding this comment

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

What about cases where we'd close multiple issues? Does the bot need to take care of that?

@enarxbot enarxbot merged commit cb1155b into enarx-archive:master Jul 30, 2020
Sprint automation moved this from Reviewing to Done Jul 30, 2020
Planning automation moved this from Assigned to Done Jul 30, 2020
@puiterwijk puiterwijk removed this from Done in Sprint Nov 10, 2022
@puiterwijk puiterwijk removed this from Done in Planning Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sprint automation: Migrate existing Github Actions automation to new system
6 participants