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

[PM-12559] Improve conditional update logic #48

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

SaintPatrck
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-12559

📔 Objective

This PR modifies the workflow to update the F-Droid repository based on certain conditions:

  • Skips updates if it's a dry-run
  • Skips updates if no changes were detected by the metascoop step
  • Runs the update_repo.sh script if changes were detected and it's not a dry run

This ensures that the repository is updated when necessary.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

This commit adds a step to update the F-Droid repository based on certain conditions:
- Skips updates if it's a dry run
- Skips updates if no changes were detected by the metascoop step
- Runs the update_repo.sh script if changes were detected and it's not a dry run

This ensures that the repository is only updated when necessary, improving efficiency and avoiding unnecessary commits.
@SaintPatrck SaintPatrck requested a review from a team as a code owner September 23, 2024 20:34
Copy link

Logo
Checkmarx One – Scan Summary & Detailse06cc289-0f3d-440e-b231-4f9112b3507d

No New Or Fixed Issues Found

@SaintPatrck SaintPatrck changed the title [PM-12559] Add conditional update logic for F-Droid repo [PM-12559] Improve conditional update logic Sep 23, 2024
@@ -122,6 +122,11 @@ jobs:
- name: Update repo
env:
GH_TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
if: ${{ (github.event_name == 'schedule' || inputs.dry-run == 'false') && steps.run-metascoop.outputs.has_changes == 'true' }}
Copy link
Member

Choose a reason for hiding this comment

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

Looking at this now, this was probably comparing bools with strings. The new changes will work due to converting them to strings first. If that's correct, this should work too:

if: ${{ (github.event_name == 'schedule' || inputs.dry-run == false) && steps.run-metascoop.outputs.has_changes == true }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I actually prefer having the verbose output though. It gives us a better idea of why changes are or are not being saved.

@SaintPatrck SaintPatrck merged commit 2c3f903 into main Sep 23, 2024
6 checks passed
@SaintPatrck SaintPatrck deleted the PM-12559/always-run-update-step branch September 23, 2024 21:15
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.

2 participants