Skip to content
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

chore(scripts): auto create autoversion PR from release script #13074

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Apr 25, 2024

Ref #12465

image

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @mafredri and the rest of your teammates on Graphite Graphite

@@ -0,0 +1,14 @@
# Some documentation
Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to commit this test case in a previous PR.

@mafredri mafredri marked this pull request as ready for review April 25, 2024 10:29
scripts/release.sh Show resolved Hide resolved
@@ -385,7 +385,7 @@ func (r *releaseCommand) autoversionFile(ctx context.Context, file, channel, ver
// Utilize the index where the match was found to replace the correct part. The only
// match group is the version.
if match := matchRe.FindStringSubmatchIndex(line); match != nil {
logger.Info(ctx, "updating version number", "line_number", i+1, "match", match)
logger.Info(ctx, "updating version number", "line_number", i+1, "match", match, "old_version", line[match[2]:match[3]])
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential here for panic; can you check that match has the expected number of elements first?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the regex matches we can expect that match to contains all the elements, but I can add an extra check just to be safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dannykopping turned this into a more robust implementation in 26df0e5, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

log "Creating pull request..."
maybedryrun "${dry_run}" gh pr create \
--assignee "@me" \
--reviewer bpmct,stirby \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we define these in an arg as default values?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you suggesting we define these at the top of the script? Or that we add CLI flags for them? Or perhaps neither of the aforementioned?

Copy link
Contributor

Choose a reason for hiding this comment

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

Either one works, so long as the reviewers can be overridden if/when we need to without modifying the script

Copy link
Member Author

Choose a reason for hiding this comment

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

I find it hard to imagine a scenario where being able to change this without modifying the script is useful 🤔. Even if it's there, it wouldn't be used and thus forgotten. The PR can always be edited on GitHub afterwards.

That's to say, I don't mind moving these vars to the top, and I can even add hidden envs for it, but not sure it's worth the effort to flag/document it.

Copy link
Member Author

Choose a reason for hiding this comment

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

scripts/release.sh Outdated Show resolved Hide resolved
@mafredri mafredri force-pushed the mafredri/04-25-chore_scripts_auto_create_autoversion_pr_from_release_script branch from 04b8614 to b29e24c Compare April 25, 2024 11:00
@@ -53,6 +53,10 @@ script_check=1
mainline=1
channel=mainline

# These values will be used for any PRs created.
pr_review_assignee=${CODER_RELEASE_PR_REVIEW_ASSIGNEE:-@me}
pr_review_reviewer=${CODER_RELEASE_PR_REVIEW_REVIEWER:-bpmct,stirby}
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe add yourself as reviewer too in case of emergency

Copy link
Member Author

Choose a reason for hiding this comment

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

I don’t want to involve myself too much in the process, since this is just docs changes I don’t think I’m needed. I will cooperate with @stirby during the next release(s) to ensure the process is smooth.

@mafredri mafredri merged commit d50a31e into main Apr 26, 2024
25 checks passed
@mafredri mafredri deleted the mafredri/04-25-chore_scripts_auto_create_autoversion_pr_from_release_script branch April 26, 2024 09:53
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2024
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.

None yet

3 participants