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

fix(ci): detect breaking ci by comparing with base branch instead of main #3692

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented Aug 26, 2024

Refactor the action to:

  • compare changes with target branch instead of main
  • detect base branch changes to trigger ci
  • don't apply kind:break! if breaking changes are detected, but there is label already
  • apply kind:break! only if it is not present

TODO: tokens need permissions to write to pull requests to allow this action to set up the label

@walldiss walldiss added the kind:ci CI related PRs label Aug 26, 2024
@walldiss walldiss self-assigned this Aug 26, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.54%. Comparing base (2469e7a) to head (0238dac).
Report is 191 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3692      +/-   ##
==========================================
+ Coverage   44.83%   45.54%   +0.70%     
==========================================
  Files         265      281      +16     
  Lines       14620    16032    +1412     
==========================================
+ Hits         6555     7301     +746     
- Misses       7313     7889     +576     
- Partials      752      842      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@walldiss walldiss changed the base branch from main to shwap August 26, 2024 18:05
@walldiss walldiss changed the base branch from shwap to pruning August 26, 2024 18:11
@walldiss walldiss changed the base branch from pruning to main August 26, 2024 18:12
@walldiss walldiss marked this pull request as ready for review August 26, 2024 18:14
@walldiss walldiss marked this pull request as draft August 26, 2024 18:14
@walldiss walldiss changed the base branch from main to release/v0.15.0 September 9, 2024 20:38
@walldiss walldiss changed the base branch from release/v0.15.0 to temp-main September 9, 2024 20:40
@walldiss walldiss changed the base branch from temp-main to main September 9, 2024 21:14
@walldiss walldiss added kind:break! Attached to breaking PRs and removed kind:break! Attached to breaking PRs labels Sep 9, 2024
@walldiss walldiss added the kind:break! Attached to breaking PRs label Sep 9, 2024
@walldiss walldiss removed the kind:break! Attached to breaking PRs label Sep 9, 2024
@walldiss walldiss changed the base branch from main to temp-main September 9, 2024 21:30
@walldiss walldiss added the kind:break! Attached to breaking PRs label Sep 9, 2024
@walldiss walldiss changed the base branch from temp-main to main September 9, 2024 22:10
@walldiss walldiss removed the kind:break! Attached to breaking PRs label Sep 9, 2024
@walldiss walldiss marked this pull request as ready for review September 9, 2024 22:11
@walldiss
Copy link
Member Author

@MSevey could you please check the GitHub token access to ensure it has write privileges for pull requests?

@MSevey
Copy link
Member

MSevey commented Sep 10, 2024

@MSevey could you please check the GitHub token access to ensure it has write privileges for pull requests?

Why do you think you need updated permissions?

The new action ran https://github.com/celestiaorg/celestia-node/actions/runs/10790001843

.github/workflows/labels.yml Show resolved Hide resolved
Comment on lines 28 to 35
if: |
(github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
github.event.action == 'reopened' ||
github.event.action == 'edited' ||
github.event.action == 'labeled' ||
github.event.action == 'unlabeled') &&
github.actor != 'dependabot[bot]'
Copy link
Member

Choose a reason for hiding this comment

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

the majority of this condition is redundant since you are just checking that the action was trigger and the only action triggers are the ones you listed.

So you can just check for dependabot

Suggested change
if: |
(github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
github.event.action == 'reopened' ||
github.event.action == 'edited' ||
github.event.action == 'labeled' ||
github.event.action == 'unlabeled') &&
github.actor != 'dependabot[bot]'
if: github.actor != 'dependabot[bot]'

.github/workflows/labels.yml Show resolved Hide resolved
make detect-breaking

- name: Add label if breaking changes detected
- name: Check if 'kind:break!' label is already present
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

@walldiss walldiss Sep 10, 2024

Choose a reason for hiding this comment

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

It is a bit concerning action has no stars or forks. It feels safer to avoid using it

NUMBER: ${{ github.event.pull_request.number }}
LABELS: kind:break!

- name: Add 'kind:break!' label if breaking changes detected
Copy link
Member

Choose a reason for hiding this comment

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

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've tried to use it, but it didn't work for some reason. Perhaps, you might want to contribute to this PR?

@MSevey
Copy link
Member

MSevey commented Sep 11, 2024

Error in the action file preventing it from running https://github.com/celestiaorg/celestia-node/actions/runs/10813060223

You should install actionlint locally so you can catch these before pushing 👍🏻
https://github.com/rhysd/actionlint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:ci CI related PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants