Skip to content

Commit

Permalink
Support GITHUB_API_TOKEN variable too (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Oct 2, 2023
1 parent 72398db commit 616dc00
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 17 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CI

permissions: {}

on:
workflow_dispatch: {}
pull_request:
Expand All @@ -18,11 +20,11 @@ jobs:
matrix:
include:
- container: alpine:latest
preinstall: apk add bash coreutils curl git
preinstall: apk add bash coreutils curl git jq
- container: centos:latest
preinstall: dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos && dnf -y install git
preinstall: dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos && dnf -y install git jq
- container: ubuntu:latest
preinstall: apt-get -y update && apt-get -y install curl git
preinstall: apt-get -y update && apt-get -y install curl git jq

runs-on: ubuntu-latest

Expand All @@ -37,12 +39,19 @@ jobs:
uses: asdf-vm/actions/plugin-test@v1
with:
command: assume --version; granted --version
env:
GITHUB_TOKEN: ${{ github.token }}

macos:
runs-on: macos-latest

steps:
- name: Preinstall
run: brew install jq

- name: Test plugin
uses: asdf-vm/actions/plugin-test@v1
with:
command: assume --version; granted --version
env:
GITHUB_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Trunk Check
uses: trunk-io/trunk-action@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
?.*
.vscode
2 changes: 1 addition & 1 deletion .trunk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
shims
22 changes: 13 additions & 9 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
version: 0.1
cli:
version: 1.9.1
version: 1.16.2
lint:
disabled:
- checkov
- trivy
- trufflehog
enabled:
- actionlint@1.6.24
- actionlint@1.6.26
- git-diff-check
- gitleaks@8.16.3
- markdownlint@0.34.0
- prettier@2.8.8
- gitleaks@8.18.0
- markdownlint@0.37.0
- prettier@3.0.3
- shellcheck@0.9.0
- shfmt@3.5.0
- yamllint@1.31.0
- shfmt@3.6.0
- yamllint@1.32.0
runtimes:
enabled:
- go@1.19.5
- go@1.21.0
- node@18.12.1
- python@3.10.8
actions:
Expand All @@ -25,5 +29,5 @@ actions:
plugins:
sources:
- id: trunk
ref: v0.0.17
ref: v1.2.5
uri: https://github.com/trunk-io/plugins
5 changes: 3 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true

[[ -z ${ASDF_INSTALL_TYPE+x} ]] && echo "ASDF_INSTALL_TYPE is required" && exit 1
[[ -z ${ASDF_INSTALL_VERSION+x} ]] && echo "ASDF_INSTALL_VERSION is required" && exit 1
Expand All @@ -16,7 +17,7 @@ install() {

local tmp_download_dir

if [[ -z ${TMPDIR:-} ]]; then
if [[ -z ${TMPDIR-} ]]; then
tmp_download_dir=$(mktemp -d)
else
tmp_download_dir=${TMPDIR%/}
Expand All @@ -37,7 +38,7 @@ install() {
local download_filename="granted_${version}_${platform}_${arch}.tar.gz"
local download_url="https://releases.commonfate.io/granted/${prefix}${version}/${download_filename}"

echo "Downloading from ${download_url}"
echo "Downloading ${download_filename} from release ${prefix}${version} from ${download_url}"

pushd "${tmp_download_dir}" >/dev/null

Expand Down
4 changes: 3 additions & 1 deletion bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true

function gh_curl() {
if [[ -n ${GITHUB_TOKEN:-} ]]; then
if [[ -n ${GITHUB_TOKEN-} ]]; then
curl -s -H "Authorization: token ${GITHUB_TOKEN}" "$@"
elif [[ -n ${GITHUB_API_TOKEN-} ]]; then
curl -s -H "Authorization: token ${GITHUB_API_TOKEN}" "$@"
else
curl -s "$@"
fi
Expand Down

0 comments on commit 616dc00

Please sign in to comment.