- Notifications
You must be signed in to change notification settings - Fork5
Update coder templates automatically
License
matifali/update-coder-template
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
UpdateCoder Template
Update coder templates automatically
Note
Please also check the offical Codersetup-action
action.
Create a GitHub secret named
CODER_SESSION_TOKEN
with your coder session tokenYou can generate a long lived session token by running the following command in your browser console while logged into Coder with aTemplate Admin orOwner role.coder token create --lifetime 8760h --name"GitHub Actions"
Create a
.github/workflows/push-coder-template.yaml
file and use one of the examples below.
Name | Description | Default |
---|---|---|
url | Required The url of coder deployment (e.g.https://dev.coder.com). | - |
coder_session_token | Required The session token of coder. | - |
id | Required The name of the template. Visible under Template Settings > General info in the coder deployment. | - |
dir | Required The directory of the template that containsmain.tf file | - |
name | New version name for the template. | Autogenerated name by Coder |
activate | Activate the new template version. | true |
message | Update message (similar to commit messages) | - |
dry_run | Dry run mode. | false |
Update a Coder template with the latest commit hash as the version name, commit message as the update message and mark this as active.
name:Update Coder Templateon:push:branches: -mainjobs:update:runs-on:ubuntu-lateststeps: -name:Checkoutuses:actions/checkout@v4 -name:Get latest commit hashid:latest_commitrun:echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT -name:Get commit titleid:commit_titlerun:echo "title=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT -name:Update Coder Templateuses:matifali/update-coder-template@v3with:id:my-templatedir:my-templateurl:https://coder.example.comname:${{ steps.latest_commit.outputs.hash }}message:${{ steps.commit_title.outputs.title }}coder_session_token:${{ secrets.CODER_SESSION_TOKEN }}
Update a Coder template with a random version name without activating.
name:Update Coder Templateon:push:branches: -mainjobs:update:runs-on:ubuntu-lateststeps: -name:Checkoutuses:actions/checkout@v4 -name:Update Coder Templateuses:matifali/update-coder-template@v3with:id:my-templatedir:my-templateurl:https://coder.example.comactivate:falsecoder_session_token:${{ secrets.CODER_SESSION_TOKEN }}
About
Update coder templates automatically
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.