-
Notifications
You must be signed in to change notification settings - Fork 4
Implement support for extension attribute scripts #11
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
base: main
Are you sure you want to change the base?
Conversation
|
@jgarcesres 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: jgarcesres <5065761+jgarcesres@users.noreply.github.com>
Co-authored-by: jgarcesres <5065761+jgarcesres@users.noreply.github.com>
…ling Co-authored-by: jgarcesres <5065761+jgarcesres@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements comprehensive support for extension attribute scripts in git2jamf, migrating from legacy JSSResource endpoints to the modern Jamf Pro API (/uapi/v1/computer-extension-attributes). The implementation includes full CRUD operations, directory separation between regular scripts and EA scripts, and automatic exclusion logic to prevent conflicts.
Key Changes
- Replaced legacy EA script functions with modern API implementations supporting pagination, better error handling, and bearer token authentication
- Added
ea_script_dirparameter to separate extension attribute scripts from regular scripts - Implemented automatic directory exclusion to prevent EA scripts from being processed as regular scripts
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| action.py | Refactored EA script functions to use modern API endpoints; added push_ea_scripts() implementation with full CRUD support; updated find_local_scripts() with directory exclusion logic; modified push_scripts() to accept exclude parameter |
| README.md | Added documentation for ea_script_dir parameter, usage examples with extension attributes, and troubleshooting section for API compatibility issues |
| action.yml | Added ea_script_dir input parameter with default value of 'false' |
| .gitignore | Added Python cache file patterns (pycache/, *.pyc) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| page+=1 | ||
| if (page*page_size) < ea_list['totalCount']: | ||
| logger.info("seems there's more EAs to grab") | ||
| eas.extend(ea_list['results']) |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expression mutates a default value.
| return get_all_jamf_extension_attributes(url, token, eas, page) | ||
| else: | ||
| logger.info("reached the end of our EA search") | ||
| eas.extend(ea_list['results']) |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expression mutates a default value.
|
|
||
| elif len(ea_search) == 1: | ||
| jamf_ea = ea_search.pop() | ||
| del jamf_ea['lower_case_name'] |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expression mutates a default value.
| del jamf_ea['lower_case_name'] | |
| del jamf_ea['lower_case_name'] | |
| ea_scripts['to_delete'] = ea_scripts['to_delete'].copy() |
This PR adds comprehensive support for extension attribute scripts in git2jamf, addressing the original limitation where EA scripts weren't supported due to API constraints that have since been resolved.
Key Features
Extension Attribute Script Support: Scripts can now be automatically created and updated as Jamf Pro extension attributes using the modern API (
/uapi/v1/computer-extension-attributes).Directory Separation: Added
ea_script_dirparameter to target a specific folder for extension attribute scripts. When enabled, these scripts are processed separately from regular scripts to prevent conflicts.Automatic Exclusion: EA script directories are automatically excluded from regular script scanning, ensuring scripts are only processed in their intended context.
Usage
Implementation Details
/JSSResource/endpoints to new/uapi/v1/computer-extension-attributesAPIDirectory Structure Example
The implementation maintains full backward compatibility while adding powerful new functionality for managing extension attribute scripts alongside regular scripts.
Fixes #10.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.