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

feat: add auto archiving action #238

Merged
merged 5 commits into from
Oct 15, 2024
Merged

feat: add auto archiving action #238

merged 5 commits into from
Oct 15, 2024

Conversation

PierreDelpy
Copy link
Contributor

@PierreDelpy PierreDelpy commented Oct 15, 2024

The goal is to automatically archive unused branches (rename to "archived/..." after 365 days of no commit).
Actual code execution is commented (since I don't want to trigger the process until approved)

These branches would be affected:
https://github.com/samply/bridgehead/actions/runs/11340581646/job/31537252148#step:5:10

Will delete this code once ready for merging

Copy link
Member

@lablans lablans left a comment

Choose a reason for hiding this comment

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

Isn't this something we should do manually? Maybe instead of renaming the branch, rather send an e-mail / alert?

Also, some Python comments in the code.

Comment on lines 29 to 33
# Rename inactive branches
for branch in get_branches():
if is_inactive(branch['commit']['url']):
#rename_branch(branch['name'], f"archived/{branch['name']}")
print(f"[LOG] Branch '{branch['name']}' is inactive and would be renamed to 'archived/{branch['name']}'")
Copy link
Member

Choose a reason for hiding this comment

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

Add if __name__ == "__main__":

Copy link
Contributor Author

@PierreDelpy PierreDelpy Oct 15, 2024

Choose a reason for hiding this comment

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

Fixed in a04d09e

.github/scripts/rename_inactive_branches.py Show resolved Hide resolved
.github/scripts/rename_inactive_branches.py Show resolved Hide resolved
.github/workflows/rename-inactive-branches.yml Outdated Show resolved Hide resolved
@PierreDelpy
Copy link
Contributor Author

Isn't this something we should do manually? Maybe instead of renaming the branch, rather send an e-mail / alert?

Yes we should definitely do this manually. Therefore, I added the 365 days of inactivity. However, some branches are forgotten and I think with our currently 32 branches, we need an additional mechanism.

PierreDelpy and others added 2 commits October 15, 2024 09:35
Co-authored-by: Martin Lablans <6804500+lablans@users.noreply.github.com>
Comment on lines 7 to 9
pull_request:
branches:
- develop
Copy link
Member

Choose a reason for hiding this comment

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

This is not required anymore, no?

@PierreDelpy PierreDelpy merged commit 7aaee5e into develop Oct 15, 2024
@PierreDelpy PierreDelpy deleted the feature/autoarchive branch October 15, 2024 11:03
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.

3 participants