Skip to content

Commit 021dd11

Browse files
Udpate job ids (#37)
* update dependabot job Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * auto apporve dependabot PRs Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * fix 1ES runners Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * move to windows 2025 Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9ed45fb commit 021dd11

File tree

4 files changed

+49
-45
lines changed

4 files changed

+49
-45
lines changed

.github/workflows/auto-merge-dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
# This workflow uses a GitHub App token to approve and merge Dependabot PRs
1010
# The token is created using the `actions/create-github-app-token` action
11-
# The token is used so that the updates are made by the GitHub App instead of GitHub Actions
11+
# The token is used so that the updates are made by the GitHub App instead of GitHub Actions
1212
# and will show up as such in the PR comments and history
1313
# In addition, the token is scoped to only the permissions needed for this workflow
1414
# 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

.github/workflows/pr-validate.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
name: Lint & Test
6060
needs: [docs-pr]
6161
if: needs.docs-pr.outputs.docs-only != 'true'
62-
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
62+
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd","JobId=hyperagent-pr-validate-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
6363
steps:
6464
- uses: actions/checkout@v6
6565

@@ -99,30 +99,31 @@ jobs:
9999
- windows-whp-release
100100
include:
101101
- build: linux-kvm-debug
102-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
103102
hypervisor: kvm
104103
config: debug
105104
- build: linux-kvm-release
106-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
107105
hypervisor: kvm
108106
config: release
109107
- build: linux-mshv-debug
110-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
111108
hypervisor: mshv
112109
config: debug
113110
- build: linux-mshv-release
114-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
115111
hypervisor: mshv
116112
config: release
117113
- build: windows-whp-debug
118-
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
119114
hypervisor: whp
120115
config: debug
121116
- build: windows-whp-release
122-
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
123117
hypervisor: whp
124118
config: release
125-
runs-on: ${{ matrix.os }}
119+
runs-on: ${{ fromJson(
120+
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId={2}-{3}-{4}-{5}"]',
121+
matrix.hypervisor == 'whp' && 'Windows' || 'Linux',
122+
matrix.hypervisor == 'whp' && 'win2025' || matrix.hypervisor == 'mshv' && 'azlinux3-mshv' || 'kvm',
123+
matrix.build,
124+
github.run_id,
125+
github.run_number,
126+
github.run_attempt)) }}
126127
steps:
127128
- uses: actions/checkout@v6
128129

.github/workflows/publish.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,22 @@ jobs:
3434
build: [linux-kvm, linux-musl, windows-whp]
3535
include:
3636
- build: linux-kvm
37-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
3837
hypervisor: kvm
3938
run_tests: true
4039
- build: linux-musl
41-
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
4240
hypervisor: kvm
4341
run_tests: false # musl .node can't run on glibc host
4442
- build: windows-whp
45-
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
4643
hypervisor: whp
4744
run_tests: true
48-
runs-on: ${{ matrix.os }}
45+
runs-on: ${{ fromJson(
46+
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId={2}-{3}-{4}-{5}"]',
47+
matrix.hypervisor == 'whp' && 'Windows' || 'Linux',
48+
matrix.hypervisor == 'whp' && 'win2025' || 'kvm',
49+
matrix.build,
50+
github.run_id,
51+
github.run_number,
52+
github.run_attempt)) }}
4953
steps:
5054
- uses: actions/checkout@v6
5155

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

scripts/auto-approve-dependabot.sh

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -121,38 +121,37 @@ echo "$dependabot_prs" | jq -c '.[]' | while read -r pr; do
121121
echo " ℹ️ PR #$pr_number is already approved"
122122
fi
123123

124-
if [ "$has_pending_checks" = true ] || [ "$all_checks_pass" = true ]; then
125-
# Check if PR is draft and whether it is up-to-date with base branch
126-
pr_merge_info=$(gh pr view "$pr_number" -R "$REPO" --json isDraft,mergeStateStatus)
127-
is_draft=$(echo "$pr_merge_info" | jq -r '.isDraft')
128-
merge_status=$(echo "$pr_merge_info" | jq -r '.mergeStateStatus')
129-
130-
if [ "$is_draft" = "true" ]; then
131-
echo " ⚠️ PR #$pr_number is a draft PR; skipping merge"
132-
continue
133-
fi
134-
135-
if [ "$merge_status" != "CLEAN" ]; then
136-
echo " ⚠️ PR #$pr_number is not up to date (status: $merge_status)"
137-
# Enable auto-merge to merge once checks pass
138-
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
139-
if gh pr merge "$pr_number" -R "$REPO" --auto --squash; then
140-
echo " ✅ Auto-merge enabled for PR #$pr_number"
141-
else
142-
echo " ⚠️ Failed to enable auto-merge for PR #$pr_number; continuing to next PR"
143-
continue
144-
fi
145-
else
146-
echo " ✅ PR #$pr_number is up to date with base branch"
147-
# PR is already clean/mergeable - merge directly instead of enabling auto-merge
148-
echo " ✅ Merging PR #$pr_number directly (squash strategy)"
149-
if gh pr merge "$pr_number" -R "$REPO" --squash; then
124+
if [ "$has_pending_checks" = true ]; then
125+
echo " ⏳ PR #$pr_number still has pending checks"
126+
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
127+
gh pr merge "$pr_number" -R "$REPO" --auto --squash
128+
echo " ✅ Auto-merge enabled for PR #$pr_number"
129+
elif [ "$all_checks_pass" = true ]; then
130+
# Check if PR is up-to-date with base branch
131+
merge_status=$(gh pr view "$pr_number" -R "$REPO" --json mergeStateStatus -q '.mergeStateStatus')
132+
133+
case "$merge_status" in
134+
CLEAN)
135+
echo " ✅ PR #$pr_number is up to date with base branch"
136+
# PR is already clean/mergeable - merge directly instead of enabling auto-merge
137+
echo " ✅ Merging PR #$pr_number directly (squash strategy)"
138+
gh pr merge "$pr_number" -R "$REPO" --squash
150139
echo " ✅ PR #$pr_number merged successfully"
151-
else
152-
echo " ⚠️ Failed to merge PR #$pr_number; continuing to next PR"
153-
continue
154-
fi
155-
fi
140+
;;
141+
BEHIND)
142+
echo " ⚠️ PR #$pr_number is behind the base branch"
143+
# Enable auto-merge to merge once the branch is updated and checks pass
144+
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
145+
gh pr merge "$pr_number" -R "$REPO" --auto --squash
146+
echo " ✅ Auto-merge enabled for PR #$pr_number"
147+
;;
148+
DIRTY|BLOCKED)
149+
echo " ⚠️ Skipping PR #$pr_number because it cannot be auto-merged (status: $merge_status)"
150+
;;
151+
*)
152+
echo " ⚠️ Skipping PR #$pr_number due to unsupported merge status: $merge_status"
153+
;;
154+
esac
156155
fi
157156

158157
done

0 commit comments

Comments
 (0)