Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the script management system by adding automatic timestamp tracking for creation and update operations in Jamf scripts. The changes implement a notes management system that preserves existing custom notes while maintaining clear tracking of when scripts were created or last updated via GitHub Actions.
- Adds timestamped notes for script creation and updates
- Implements logic to preserve existing custom notes while managing GitHub Action timestamps
- Updates documentation to explain the new notes management behavior
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| action.py | Adds datetime import and two new functions for creating timestamped notes, plus integration into script creation/update workflow |
| README.md | Updates documentation to explain the new notes management system and fixes a typo |
action.py
Outdated
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S UTC") | ||
| return f"created via github action on {timestamp}" | ||
|
|
||
|
|
||
| #function to create or update notes with proper timestamping | ||
| @logger.catch | ||
| def update_script_notes(existing_notes, action_type="updated"): | ||
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S UTC") |
There was a problem hiding this comment.
The timestamp format includes 'UTC' but datetime.now() returns local time, not UTC time. Use datetime.now(timezone.utc) or datetime.utcnow() to get actual UTC time.
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S UTC") | |
| return f"created via github action on {timestamp}" | |
| #function to create or update notes with proper timestamping | |
| @logger.catch | |
| def update_script_notes(existing_notes, action_type="updated"): | |
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S UTC") | |
| timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC") | |
| return f"created via github action on {timestamp}" | |
| #function to create or update notes with proper timestamping | |
| @logger.catch | |
| def update_script_notes(existing_notes, action_type="updated"): | |
| timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC") |
action.py
Outdated
| return False | ||
|
|
||
|
|
||
| #function to create a creation note with timestamp |
There was a problem hiding this comment.
Comment should start with a capital letter and end with a period: 'Function to create a creation note with timestamp.'
| #function to create a creation note with timestamp | |
| # Function to create a creation note with timestamp. |
| return f"created via github action on {timestamp}" | ||
|
|
||
|
|
||
| #function to create or update notes with proper timestamping |
There was a problem hiding this comment.
Comment should start with a capital letter and end with a period: 'Function to create or update notes with proper timestamping.'
| #function to create or update notes with proper timestamping | |
| # Function to create or update notes with proper timestamping. |
| return '\n'.join(updated_lines) | ||
|
|
||
|
|
||
| #retrieves list of files given a folder path and the list of valid file extensions to look for |
There was a problem hiding this comment.
Comment should start with a capital letter and end with a period: 'Retrieves list of files given a folder path and the list of valid file extensions to look for.'
| #retrieves list of files given a folder path and the list of valid file extensions to look for | |
| # Retrieves list of files given a folder path and the list of valid file extensions to look for. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Solves this issue #8