|
4 | 4 | The script will check the following conditions: |
5 | 5 | 1. **Is today a release day?** |
6 | 6 | - The script checks if today is a specified in ReleaseConfig weekday that falls on the release cycle of the team. |
| 7 | + - Note that if the job is triggered manually, this condition will be bypassed. |
7 | 8 | 2. **Is the [Unreleased] section of the CHANGELOG.md not empty?** |
8 | 9 | - The script checks if the [Unreleased] section in the CHANGELOG.md contains meaningful entries. |
9 | 10 | 3. **Does the release branch already exist?** |
|
21 | 22 | import re |
22 | 23 | from release_config import ReleaseConfig |
23 | 24 |
|
| 25 | +def get_yamato_trigger_type(): |
| 26 | + """ |
| 27 | + Retrieves the trigger type for the current Yamato job from environment variables. |
| 28 | + In other words, we can check if the job was triggered manually, by a schedule, or by a PR, etc. |
| 29 | + """ |
| 30 | + trigger_type = os.environ.get('YAMATO_TRIGGER_TYPE', 'unknown') |
| 31 | + return trigger_type |
| 32 | + |
| 33 | + |
24 | 34 | def is_release_date(weekday, release_week_cycle, anchor_date): |
25 | 35 | """ |
26 | 36 | Checks if today is a weekday that falls on the release_week_cycle starting from anchor_date . |
@@ -74,7 +84,7 @@ def verifyReleaseConditions(config: ReleaseConfig): |
74 | 84 | error_messages = [] |
75 | 85 |
|
76 | 86 | try: |
77 | | - if not is_release_date(config.release_weekday, config.release_week_cycle, config.anchor_date): |
| 87 | + if get_yamato_trigger_type() != "Manual" and not is_release_date(config.release_weekday, config.release_week_cycle, config.anchor_date): |
78 | 88 | error_messages.append(f"Condition not met: Today is not the scheduled release day. It should be weekday: {config.release_weekday}, every {config.release_week_cycle} weeks starting from {config.anchor_date}.") |
79 | 89 |
|
80 | 90 | if is_changelog_empty(config.changelog_path): |
|
0 commit comments