Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

# This workflow uses a GitHub App token to approve and merge Dependabot PRs
# The token is created using the `actions/create-github-app-token` action
# The token is used so that the updates are made by the GitHub App instead of GitHub Actions
# The token is used so that the updates are made by the GitHub App instead of GitHub Actions
# and will show up as such in the PR comments and history
# In addition, the token is scoped to only the permissions needed for this workflow
# see https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow for details
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/pr-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
name: Lint & Test
needs: [docs-pr]
if: needs.docs-pr.outputs.docs-only != 'true'
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd","JobId=hyperagent-pr-validate-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -99,30 +99,31 @@ jobs:
- windows-whp-release
include:
- build: linux-kvm-debug
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
config: debug
- build: linux-kvm-release
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
config: release
- build: linux-mshv-debug
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
hypervisor: mshv
config: debug
- build: linux-mshv-release
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
hypervisor: mshv
config: release
- build: windows-whp-debug
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
hypervisor: whp
config: debug
- build: windows-whp-release
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
hypervisor: whp
config: release
runs-on: ${{ matrix.os }}
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId={2}-{3}-{4}-{5}"]',
matrix.hypervisor == 'whp' && 'Windows' || 'Linux',
matrix.hypervisor == 'whp' && 'win2025' || matrix.hypervisor == 'mshv' && 'azlinux3-mshv' || 'kvm',
matrix.build,
github.run_id,
github.run_number,
github.run_attempt)) }}
steps:
- uses: actions/checkout@v6

Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,22 @@ jobs:
build: [linux-kvm, linux-musl, windows-whp]
include:
- build: linux-kvm
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
run_tests: true
- build: linux-musl
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
run_tests: false # musl .node can't run on glibc host
- build: windows-whp
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
hypervisor: whp
run_tests: true
runs-on: ${{ matrix.os }}
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId={2}-{3}-{4}-{5}"]',
matrix.hypervisor == 'whp' && 'Windows' || 'Linux',
matrix.hypervisor == 'whp' && 'win2025' || 'kvm',
matrix.build,
github.run_id,
github.run_number,
github.run_attempt)) }}
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -110,7 +114,7 @@ jobs:
publish-npm:
name: Publish to npmjs.org
needs: [build-native]
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd","JobId=hyperagent-publish-npm-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
steps:
- uses: actions/checkout@v6

Expand Down
61 changes: 30 additions & 31 deletions scripts/auto-approve-dependabot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,38 +121,37 @@ echo "$dependabot_prs" | jq -c '.[]' | while read -r pr; do
echo " ℹ️ PR #$pr_number is already approved"
fi

if [ "$has_pending_checks" = true ] || [ "$all_checks_pass" = true ]; then
# Check if PR is draft and whether it is up-to-date with base branch
pr_merge_info=$(gh pr view "$pr_number" -R "$REPO" --json isDraft,mergeStateStatus)
is_draft=$(echo "$pr_merge_info" | jq -r '.isDraft')
merge_status=$(echo "$pr_merge_info" | jq -r '.mergeStateStatus')

if [ "$is_draft" = "true" ]; then
echo " ⚠️ PR #$pr_number is a draft PR; skipping merge"
continue
fi

if [ "$merge_status" != "CLEAN" ]; then
echo " ⚠️ PR #$pr_number is not up to date (status: $merge_status)"
# Enable auto-merge to merge once checks pass
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
if gh pr merge "$pr_number" -R "$REPO" --auto --squash; then
echo " ✅ Auto-merge enabled for PR #$pr_number"
else
echo " ⚠️ Failed to enable auto-merge for PR #$pr_number; continuing to next PR"
continue
fi
else
echo " ✅ PR #$pr_number is up to date with base branch"
# PR is already clean/mergeable - merge directly instead of enabling auto-merge
echo " ✅ Merging PR #$pr_number directly (squash strategy)"
if gh pr merge "$pr_number" -R "$REPO" --squash; then
if [ "$has_pending_checks" = true ]; then
echo " ⏳ PR #$pr_number still has pending checks"
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
gh pr merge "$pr_number" -R "$REPO" --auto --squash
echo " ✅ Auto-merge enabled for PR #$pr_number"
elif [ "$all_checks_pass" = true ]; then
# Check if PR is up-to-date with base branch
merge_status=$(gh pr view "$pr_number" -R "$REPO" --json mergeStateStatus -q '.mergeStateStatus')

case "$merge_status" in
CLEAN)
echo " ✅ PR #$pr_number is up to date with base branch"
# PR is already clean/mergeable - merge directly instead of enabling auto-merge
echo " ✅ Merging PR #$pr_number directly (squash strategy)"
gh pr merge "$pr_number" -R "$REPO" --squash
echo " ✅ PR #$pr_number merged successfully"
else
echo " ⚠️ Failed to merge PR #$pr_number; continuing to next PR"
continue
fi
fi
;;
BEHIND)
echo " ⚠️ PR #$pr_number is behind the base branch"
# Enable auto-merge to merge once the branch is updated and checks pass
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
gh pr merge "$pr_number" -R "$REPO" --auto --squash
echo " ✅ Auto-merge enabled for PR #$pr_number"
;;
DIRTY|BLOCKED)
echo " ⚠️ Skipping PR #$pr_number because it cannot be auto-merged (status: $merge_status)"
;;
*)
echo " ⚠️ Skipping PR #$pr_number due to unsupported merge status: $merge_status"
;;
esac
fi

done
Expand Down
Loading