{"id":15626036,"url":"https://github.com/jgarcesres/git2jamf","last_synced_at":"2025-04-28T16:04:10.206Z","repository":{"id":65160319,"uuid":"253149224","full_name":"jgarcesres/git2jamf","owner":"jgarcesres","description":"Github action to create, update and delete scripts in jamf :octocat:","archived":false,"fork":false,"pushed_at":"2023-09-21T15:53:54.000Z","size":210,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-28T16:03:20.234Z","etag":null,"topics":["actions","api","integration","jamf","jamf-github","jamfpro","jamfpro-scripts","workflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgarcesres.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-05T03:39:32.000Z","updated_at":"2025-03-18T20:51:16.000Z","dependencies_parsed_at":"2024-10-03T10:19:39.191Z","dependency_job_id":null,"html_url":"https://github.com/jgarcesres/git2jamf","commit_stats":{"total_commits":161,"total_committers":2,"mean_commits":80.5,"dds":"0.40372670807453415","last_synced_commit":"3bc06f4768a447d2d18850e5eb16b3c7a2cf5f90"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarcesres%2Fgit2jamf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarcesres%2Fgit2jamf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarcesres%2Fgit2jamf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarcesres%2Fgit2jamf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgarcesres","download_url":"https://codeload.github.com/jgarcesres/git2jamf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342721,"owners_count":21574244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","api","integration","jamf","jamf-github","jamfpro","jamfpro-scripts","workflow"],"created_at":"2024-10-03T10:09:37.339Z","updated_at":"2025-04-28T16:04:10.159Z","avatar_url":"https://github.com/jgarcesres.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git2jamf [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\nThis action grabs the github repository (or any subdfolder of your choice) scans it for scripts and will create or update those scripts in jamf.\n\nIt starts by comparing filename of the github script (without the extension) against the name of the script in jamf:\n* If it doesn't exist, it will create it\n* if it exists, it will compare the hash of the body of both scripts and update it in jamf if they differ. Github is always treated as the source.\n* If enabled, it will add a prefix with the `branch name_`  to a script. \n\nAfter creating and updating scripts, if enabled, it can delete any leftover script that is not found in github, thus keeping Github as your one source.\n\n## Future state\n* handle extension attributes. \n* slack notifications\n* suggestions are welcome!\n\n## Inputs\n### `jamf_url`\n\n**Required** the url of your jamf instance\n\n### `jamf_auth_type`\n\n**Optional** Defaults to `auth` but can be set to `oauth` to use `client_id` and `client_secret` instead of a username and password.\n\n### `jamf_username`\n\n**Required** the username to auth against jamf. If `auth_type` is set to `oauth`, this is the `client_id` . **This user should have permission to update and create scripts.**\n\n### `jamf_password`\n\n**Required** password for the user. If `auth_type` is set to `oauth`, this is the `client_secret`\n\n### `script_dir`\n\n**optional** the directory where the scripts to upload will be, this could be a subdirectoy in your repository `path/to/scripts`. By default it will try to sync all .sh and .py files from the repo, so it's **greatly recommended to provide this input**,  you can look for multiple subdirectories that share the same name, just provide a name like `**/scripts`\n\n### `script_extensions`\n\n**optional** the extensions for the types of files we'll be searching for. By default it tries to look for `*.sh and *.py` files. To change the behavior, separate each extension with spaces and no periods. ie `sh py ps1`\n\n### `delete`\n\n**optional** by default this will be `false`, if enabled it will delete any scripts that are not found in the github folder you're syncing. **Don't enable this and the prefix at the same time if you're running multiple workflows, they're not compatible**\n\n### `prefix`\n\n**optional** by default this will be `false`, it will add the branch name as a prefix to the script before uploading it. \n\n## Outputs\n\n### `results`\n\nwhat scripts were updated\n\n\n## Getting started.\n* First, you'll want to create the secrets that will be needed for this to work. You can do this in the settings of your repository, you'll reference those secrets in the workflow file. \n* Now create the workflow file in `.github/workflows/git2jamf.yml`\n* You can use the example bellow as a basis(replace the secret values for the names of the ones you created). \n* In this example, the action runs only when a push is sent to master and it's attempting to sync a folder called `scripts` at the root of the repository. \n* You can customize it further using githubs [workflow documentation](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions)\n\n**NOTE**: If possible, I recommend running this on a test instance first. If you can't, then try syncing just one folder with a small set of scripts so you can get a feel for how it works.\n\n```yaml\nname: git2jamf\non:\n  push:\n    branches: \n      - master\njobs:\n  jamf_scripts:\n    runs-on: ubuntu-latest\n    name: git2jamf\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: git2jamf\n        uses: jgarcesres/git2jamf@master\n        with: \n          jamf_url: ${{ secrets.jamf_test_url }}\n          jamf_username: ${{ secrets.jamf_test_username }}\n          jamf_password: ${{ secrets.jamf_test_password }}\n          script_dir: 'scripts'\n```\n\n\n## Example usage with 2 instances\nyou would probably have 2 sets of secrets, with url and credentials for each instance(or share the same user creds across both servers). You also will need 2 workflow files: one for pushes to the master branch and another that goes to test. \n\n```yaml\nname: git2jamf_test\non:\n  pull_request:\n    branches:\n      - master\n  push:\n    branches: \n      - test*\n      - dev*\njobs:\n  jamf_scripts:\n    runs-on: ubuntu-latest\n    name: git2jgit2jamf_testamf\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: git2jamf_test \n        uses: jgarcesres/git2jamf@master\n        with: \n          jamf_url: ${{ secrets.jamf_test_url }}\n          jamf_username: ${{ secrets.jamf_test_username }}\n          jamf_password: ${{ secrets.jamf_test_password }}\n          script_dir: '**/scripts'\n```\n```yaml\nname: git2jamf\non:\n  push:\n    branches: \n      - master\njobs:\n  jamf_scripts:\n    runs-on: ubuntu-latest\n    name: git2jamf\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: git2jamf\n        uses: jgarcesres/git2jamf@master\n        with: \n          jamf_url: ${{ secrets.jamf_prod_url }}\n          jamf_username: ${{ secrets.jamf_prod_username }}\n          jamf_password: ${{ secrets.jamf_prod_password }}\n          script_dir: '**/scripts'\n```\n\n\n## Example usage with one instance\nThe prefix remains enabled for the test branch. This might create a bit of \"garbage\" as the scripts that have a prefix won't be deleted automatically. \n\n```yaml\nname: git2jamf_test\non:\n  push:\n    branches: \n      - test\njobs:\n  jamf_scripts:\n    runs-on: ubuntu-latest\n    name: git2jamf_test\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: git2jamf_test\n        uses: jgarcesres/git2jamf@master\n        with: \n          jamf_url: ${{ secrets.jamf_url }}\n          jamf_username: ${{ secrets.jamf_username }}\n          jamf_password: ${{ secrets.jamf_password }}\n          script_dir: toplevelfolder/scripts\n          enable_prefix: true\n```  \n```yaml\nname: git2jamf\non:\n  push:\n    branches: \n      - master\njobs:\n  jamf_scripts:\n    runs-on: ubuntu-latest\n    name: git2jamf\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: git2jamf\n        uses: jgarcesres/git2jamf@master\n        with: \n          jamf_url: ${{ secrets.jamf_url }}\n          jamf_username: ${{ secrets.jamf_username }}\n          jamf_password: ${{ secrets.jamf_password }}\n          script_dir: toplevelfolder/scripts\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgarcesres%2Fgit2jamf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgarcesres%2Fgit2jamf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgarcesres%2Fgit2jamf/lists"}