Skip to content

Commit

Permalink
Add authorization support for GitHub API
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffaluff committed Oct 31, 2024
1 parent eebea21 commit 96af838
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Test installation, setup, and bootstrapping
env:
BOOTWARE_GITHUB_TOKEN: ${{ github.token }}
uses: vmactions/freebsd-vm@v1
with:
envs: BOOTWARE_GITHUB_TOKEN
prepare: |
sudo freebsd-update fetch
sudo freebsd-update install
Expand Down Expand Up @@ -223,6 +226,8 @@ jobs:
- name: Install dependencies for Bootware
run: bootware setup
- name: Test bootstrapping
env:
BOOTWARE_GITHUB_TOKEN: ${{ github.token }}
run: >-
bootware bootstrap --dev --no-passwd --retries 3 --tags desktop,extras
# Yazi hangs during startup on GitHub Arm64 MacOS runners.
Expand Down Expand Up @@ -390,6 +395,8 @@ jobs:
# 03/09/2024 respectively due to hash checksum issues. As of 09/08/2024,
# QEMU installer experiences timeout issues.
- name: Test bootstrapping
env:
BOOTWARE_GITHUB_TOKEN: ${{ github.token }}
run: |
$Env:Path = "C:\Program Files\Bootware;$Env:Path"
bootware bootstrap --dev --no-setup --retries 3 --skip ffsend,qemu,qsv --tags desktop,extras
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

- name: Get latest Croc version for Linux
ansible.builtin.uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/schollz/croc/releases/latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

- name: Get latest GitHub Runner version for Unix
ansible.builtin.uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/actions/runner/releases/latest
Expand All @@ -125,6 +126,7 @@

- name: Get latest GitHub Runner version for Windows
ansible.windows.win_uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/actions/runner/releases/latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: Get latest Kubeshark version for Unix
ansible.builtin.uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/kubeshark/kubeshark/releases/latest
Expand All @@ -21,6 +22,7 @@

- name: Get latest Kubeshark version for Windows
ansible.windows.win_uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/kubeshark/kubeshark/releases/latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

- name: Get latest Terraform version for Unix
ansible.builtin.uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/hashicorp/terraform/releases/latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# As of 12/10/2023, Usql is not in the main Homebrew package list.
- name: Get latest Usql version for Linux
ansible.builtin.uri:
headers: "{{ github_api_headers }}"
method: GET
return_content: true
url: https://api.github.com/repos/xo/usql/releases/latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ fish_executable_:
'/usr/local' }}/bin/fish
FreeBSD: /usr/local/bin/fish
Linux: /usr/bin/fish
github_api_token_: >-
{{ lookup('ansible.builtin.env', 'BOOTWARE_GITHUB_TOKEN', default='') }}
group_id_:
Darwin: staff
Linux: "{{ {'zypper': 'users'}.get(ansible_pkg_mgr, user_id) }}"
Expand Down Expand Up @@ -62,8 +64,11 @@ bash_executable: "{{ bash_executable_.get(ansible_system, '/bin/bash') }}"
brew_user: "{{ user_id }}"
fish_completion: >-
{{ fish_completion_.get(ansible_system, '/etc/fish/completions') }}
fish_executable: "{{ fish_executable_.get(ansible_system, '/usr/bin/fish') }}"
fish_executable: "{{ fish_executable_.get(ansible_system, '/usr/bin/fish') }}"
font_size: 14
github_api_headers: >-
{{ {'Authorization': 'Bearer ' + github_api_token_} if github_api_token_ else
{} }}
group_id: "{{ group_id_.get(ansible_system, user_id) }}"
# Backslashes are required for Windows Defender firewall rules.
scoop_apps: >-
Expand Down
1 change: 1 addition & 0 deletions tests/unit/install.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Describe 'Install' {
It 'Pass local path to DownloadFile' {
If (Get-Command -ErrorAction SilentlyContinue bootware) {
Mock bootware { Write-Output '' }
Mock CheckEnvironment { Write-Output '' }
}
Else {
Function bootware() { Write-Output '' }
Expand Down

0 comments on commit 96af838

Please sign in to comment.