Skip to content

fix(extend-awards): add check for existing branch with pending awards #2093

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

Merged
merged 1 commit into from
Apr 16, 2025

Conversation

brymut
Copy link
Contributor

@brymut brymut commented Apr 11, 2025

Description

Currently as described in #1991, when a PR is merged while a PR previously opened by the extend-awards workflow is still opened & unmerged into master, the workflow runs again and overwrites the prior changes.

This PR addresses this issue by adding steps in the workflow to first check if the branch that the workflow creates is available, signalling that there is still a PR open trying to extend the awards.csv file. If there is a branch, the workflow instead pushes a commit to that branch rather than creating a new PR and overwriting changes.

I checked on alternative approaches. Based on the docs for the create-pull-request there is no obvious application/example that addresses this issue. Also, creating differently named branches for each github workflow run would create conflicts as the master branch would change and the master that earlier PR's would be made with would be outdated with new extensions. So I think this is the simplest, most straight forward approach.

Closes #1991

Screenshots

My testing approach was to run this workflow on my fork of this repo and created a test repowith the labels used for extend-awards replicated there. Here is a screen recording demonstrating fixed functionality using the Github web UI:

extend-awards-workflow.mp4

Additional Context

Branch deletion: Since this approach relies on checking if the extend-awards/patch exists to detect if there is an open PR since this workflow creates that branch, we need to delete that branch when we have merged back into master so I have added the "delete-branch" option to the create-pull-request step to do so. As explained in the docs for the Github action, this doesn't delete the branch immediately, so I would recommend that the person merging deletes the branch when they are done. I have added a reminder to the PR message with the same. Alternatively, as mentioned in the docs, the repo could use GitHub's Automatically delete head branches feature in the repository settings.

Checklist

Are your changes backwards compatible? Please answer below:
Yes, AFAIK

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
10

@brymut brymut closed this Apr 11, 2025
@brymut brymut deleted the patch-1 branch April 11, 2025 14:17
@brymut brymut restored the patch-1 branch April 11, 2025 14:17
@brymut brymut reopened this Apr 11, 2025
@brymut brymut marked this pull request as ready for review April 11, 2025 14:55
@brymut
Copy link
Contributor Author

brymut commented Apr 11, 2025

Hi @huumn / @ekzyis , I believe this is ready for review.

@huumn
Copy link
Member

huumn commented Apr 16, 2025

I'll merge to test it and we'll revert if need be.

@huumn huumn merged commit 7bde3fe into stackernews:master Apr 16, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Github action for extending awards.csv force pushes over other pending awards.csv changes
2 participants