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

ci: 💚 Add repository_dispatch event to GitHub Actions workflows #1548

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

Anselmoo
Copy link
Owner

@Anselmoo Anselmoo commented Sep 1, 2024

All PR-Submissions:


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open
    Pull Requests for the same
    update/change?

New ✨✨ Feature-Submissions:


  • Does your submission pass tests?
  • Have you lint your code locally prior to submission? Fixed:
  • This PR is for a new feature, not a bug fix.

Changes to ⚙️ Core-Features:


  • Have you added an explanation of what your changes do and why you'd like
    us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Summary by Sourcery

Integrate repository_dispatch event into multiple GitHub Actions workflows to allow triggering via external events and enhance the weekly-poetry-bot workflow with additional steps for labeling, checking, and merging pull requests.

CI:

  • Add repository_dispatch event to the CodeQL, Docker CI, and Python CI GitHub Actions workflows to trigger workflows via external events.
  • Enhance the weekly-poetry-bot workflow by adding steps to label pull requests, wait for required checks, and automatically merge pull requests.

@Anselmoo Anselmoo enabled auto-merge (squash) September 1, 2024 14:39
Copy link

Review changes with SemanticDiff.

Copy link
Contributor

sourcery-ai bot commented Sep 1, 2024

Reviewer's Guide by Sourcery

This pull request enhances the GitHub Actions workflows by adding repository_dispatch events and improving the weekly-poetry-bot workflow. The changes focus on automating the process of updating dependencies, adding labels, and merging pull requests after required checks pass.

File-Level Changes

Change Details Files
Enhanced weekly-poetry-bot workflow with automated PR management
  • Added step to label the PR as 'weekly-update'
  • Implemented a wait step for required checks to pass
  • Uncommented and enabled the PR merge step
  • Used gh CLI commands for PR management
.github/workflows/weekly-poetry-bot.yml
Added repository_dispatch event to trigger workflows
  • Added repository_dispatch event with 'create-pull-request' type
.github/workflows/codeql.yml
.github/workflows/docker-ci.yml
.github/workflows/python-ci.yml

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@Anselmoo Anselmoo disabled auto-merge September 1, 2024 14:39
@github-actions github-actions bot added the github-actions Pull requests that update Github_actions code label Sep 1, 2024
@Anselmoo Anselmoo merged commit 519bfc6 into main Sep 1, 2024
13 of 14 checks passed
@Anselmoo Anselmoo deleted the fix/weekly-2 branch September 1, 2024 14:40
Copy link

sonarqubecloud bot commented Sep 1, 2024

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Anselmoo - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a brief explanation in the PR description about the motivation for adding the repository_dispatch event to the workflows.
  • Ensure that the GITHUB_TOKEN used in the workflows has the necessary permissions and is securely managed. It might be helpful to mention any security considerations in the PR description.
  • Add comments in the workflow files to explain the purpose of the new repository_dispatch event for better documentation and future reference.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

- name: Wait for required checks
run: |
pr_number=$(gh pr view --json number --jq '.number')
gh pr checks --wait $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.

suggestion (performance): Add a timeout to the wait for checks command

Consider adding a timeout to this command to prevent the workflow from hanging indefinitely if a check fails or takes too long. For example: gh pr checks --wait $pr_number --timeout 30m

Suggested change
gh pr checks --wait $pr_number
gh pr checks --wait $pr_number --timeout 30m

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e5d1ee7) to head (d31985e).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1548   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines         4466      4466           
=========================================
  Hits          4466      4466           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github-actions Pull requests that update Github_actions code size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant