Skip to content

Conversation

Copy link

Copilot AI commented Sep 12, 2025

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_dir parameter 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

- name: git2jamf
  uses: jgarcesres/git2jamf@main
  with: 
    jamf_url: ${{ secrets.jamf_url }}
    jamf_username: ${{ secrets.jamf_username }}
    jamf_password: ${{ secrets.jamf_password }}
    script_dir: 'scripts'
    ea_script_dir: 'extension-attributes'  # New parameter

Implementation Details

  • Modern API Integration: Migrated from legacy /JSSResource/ endpoints to new /uapi/v1/computer-extension-attributes API
  • Full CRUD Operations: Support for creating, updating, and deleting extension attributes with hash-based change detection
  • Enhanced Error Handling: Comprehensive error messages and troubleshooting guidance for API compatibility issues
  • Robust Testing: Verified directory exclusion logic and payload structure validation

Directory Structure Example

your-repo/
├── scripts/              # Regular Jamf Pro scripts
│   ├── install_app.sh
│   └── configure_system.py
└── extension-attributes/  # Extension attribute scripts  
    ├── check_app_version.sh
    └── get_system_info.py

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.

Copy link
Author

Copilot AI commented Sep 12, 2025

@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.

Copilot AI and others added 3 commits September 12, 2025 04:13
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>
Copilot AI changed the title [WIP] Implement support for extension attribute scripts Implement support for extension attribute scripts Sep 12, 2025
Copilot AI requested a review from jgarcesres September 12, 2025 04:22
Copilot finished work on behalf of jgarcesres September 12, 2025 04:22
@jgarcesres jgarcesres requested a review from Copilot November 14, 2025 18:24
Copilot finished reviewing on behalf of jgarcesres November 14, 2025 18:26
Copy link

Copilot AI left a 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_dir parameter 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'])
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
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'])
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.

elif len(ea_search) == 1:
jamf_ea = ea_search.pop()
del jamf_ea['lower_case_name']
Copy link

Copilot AI Nov 14, 2025

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.

Suggested change
del jamf_ea['lower_case_name']
del jamf_ea['lower_case_name']
ea_scripts['to_delete'] = ea_scripts['to_delete'].copy()

Copilot uses AI. Check for mistakes.
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.

Implement support for extension attribute scripts

2 participants