1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-11 05:39:45 +08:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Yu Xiang Z.
424537549d
Merge b3fe6c2880 into 9df4ea095f 2026-02-06 08:08:27 +03:00
dependabot[bot]
9df4ea095f
chore(deps): bump step-security/harden-runner from 2.14.0 to 2.14.1 (#13547)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.14.0 to 2.14.1.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](20cf305ff2...e3f713f2d8)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.14.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-02 09:49:29 +01:00
dependabot[bot]
1a253c375a
chore(deps): bump github/codeql-action from 4.31.11 to 4.32.0 (#13548)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.11 to 4.32.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](19b2f06db2...b20883b0cd)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-02 09:49:06 +01:00
Yu Xiang Zhang
b3fe6c2880 perf(aws): speed up asp region lookup by parsing config file directly
Add `_aws_get_profile_region` helper that parses ~/.aws/config directly
instead of invoking `aws configure get region`, which has significant
startup overhead due to the Python-based AWS CLI.

Falls back to AWS CLI if the fast method doesn't find a region.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 17:10:30 -05:00
Yu Xiang Zhang
6f27d734c8 perf(aws): speed up aws_profiles by parsing config files directly
Parse ~/.aws/config and ~/.aws/credentials directly instead of invoking
`aws configure list-profiles`, which has significant startup overhead
due to the Python-based AWS CLI.

Falls back to AWS CLI if neither file is readable.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 17:09:39 -05:00
6 changed files with 54 additions and 11 deletions

View File

@ -13,7 +13,7 @@ jobs:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit

View File

@ -26,7 +26,7 @@ jobs:
- macos-latest - macos-latest
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit
@ -47,7 +47,7 @@ jobs:
- test - test
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit

View File

@ -24,7 +24,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit

View File

@ -17,7 +17,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh

View File

@ -36,7 +36,7 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with: with:
egress-policy: audit egress-policy: audit
@ -60,6 +60,6 @@ jobs:
retention-days: 5 retention-days: 5
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@ -42,7 +42,7 @@ function asp() {
export AWS_PROFILE=$1 export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1 export AWS_EB_PROFILE=$1
export AWS_PROFILE_REGION=$(aws configure get region) export AWS_PROFILE_REGION=$(_aws_get_profile_region "$1")
_aws_update_state _aws_update_state
@ -239,9 +239,52 @@ function aws_regions() {
} }
function aws_profiles() { function aws_profiles() {
aws --no-cli-pager configure list-profiles 2> /dev/null && return local config_file="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 local credentials_file="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g' local profiles=()
# Parse config file: match [default], [profile name], but not [sso-session ...] etc.
# Pattern handles optional whitespace around brackets and profile keyword
if [[ -r "$config_file" ]]; then
profiles+=($(grep --color=never -Eo '\[.*\]' "$config_file" \
| sed -nE 's/^[[:space:]]*\[(profile[[:space:]]+)?([^[:space:]]+)[[:space:]]*\]$/\2/p' \
| grep -v '^sso-session$'))
fi
# Parse credentials file (profiles have [name] format, no "profile" prefix)
if [[ -r "$credentials_file" ]]; then
profiles+=($(grep --color=never -Eo '\[.*\]' "$credentials_file" \
| sed -nE 's/^[[:space:]]*\[([^[:space:]]+)[[:space:]]*\]$/\1/p'))
fi
# Return unique profiles, or fall back to AWS CLI
if [[ ${#profiles[@]} -gt 0 ]]; then
printf '%s\n' "${profiles[@]}" | sort -u
else
aws --no-cli-pager configure list-profiles 2>/dev/null
fi
}
# Fast region lookup by parsing config file directly, with fallback to AWS CLI
function _aws_get_profile_region() {
local profile="${1:-$AWS_PROFILE}"
local config_file="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
local region=""
# Try fast config file parsing first
if [[ -r "$config_file" ]]; then
region=$(awk -v profile="$profile" '
/^\[/ { in_profile = ($0 ~ "\\[(profile )?[ ]*"profile"[ ]*\\]") }
in_profile && /^[ ]*region[ ]*=/ { gsub(/^[ ]*region[ ]*=[ ]*/, ""); gsub(/[ ]*$/, ""); print; exit }
' "$config_file")
fi
# Fallback to AWS CLI if fast method didn't find region
if [[ -z "$region" ]]; then
region=$(aws configure get region --profile "$profile" 2>/dev/null)
fi
echo "$region"
} }
function _aws_regions() { function _aws_regions() {