-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yaml
37 lines (31 loc) · 1.24 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Add ghommit to /usr/local/bin
description: Add ghommit to /usr/local/bin
inputs:
access_token:
description: 'A personal access token (PAT) or installation access token'
required: true
runs:
using: "composite"
steps:
- name: Add ghommit to /usr/local/bin
env:
ACCESS_TOKEN: ${{ inputs.access_token }}
shell: bash
run: |
sudo apt-get install -y jq
# - https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases
LATEST_RELEASE_JSON=$(curl -L \
-H 'Accept: application/vnd.github+json' \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H 'X-GitHub-Api-Version: 2022-11-28' \
https://api.github.com/repos/gemini-oss/ghommit/releases/latest
)
# - https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset
ASSET_URL=$(echo "${LATEST_RELEASE_JSON}" | jq --raw-output '.assets[] | select(.name == "ghommit") | .url')
curl -LJO \
-H 'Accept: application/octet-stream' \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H 'X-GitHub-Api-Version: 2022-11-28' \
"${ASSET_URL}"
chmod +x ghommit
sudo mv ghommit /usr/local/bin