Skip to content

Commit 233447a

Browse files
committed
do it
1 parent eeccc42 commit 233447a

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

.github/workflows/clk-rebase.yml

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,6 @@ jobs:
6363
# with --allowerasing
6464
dnf install curl --allowerasing -y
6565
66-
- name: Check if token can push
67-
run: |
68-
REPO_PERMS=$(curl -s -H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
69-
-H "Accept: application/vnd.github+json" \
70-
"https://api.github.com/repos/${{ github.repository }}" \
71-
| jq -r '.permissions')
72-
73-
PUSH_ALLOWED=$(echo "$REPO_PERMS" | jq -r '.push')
74-
75-
if [ "$PUSH_ALLOWED" == "true" ]; then
76-
echo "✓ Token has push permissions"
77-
else
78-
echo "✗ Token does NOT have push permissions. Full permissions object: $REPO_PERMS"
79-
#exit 1
80-
fi
81-
82-
83-
8466
- name: Checkout kernel-src-tree
8567
uses: actions/checkout@v4
8668
with:
@@ -112,9 +94,6 @@ jobs:
11294
11395
../kernel-src-tree-tools/lt_rebase.sh $STABLE_TRACKING_BRANCH
11496
115-
# HACK HACK HACK do this early for testing
116-
git push origin $CLK_NEXT_BRANCH
117-
git push origin $TMP_CLK_NEXT_BRANCH
11897
- name: Build kernel
11998
run: |
12099
cd kernel-src-tree
@@ -163,7 +142,19 @@ jobs:
163142
164143
vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh
165144
145+
- name: Generate fresh token for push and PR
146+
id: generate-push-token
147+
uses: actions/create-github-app-token@v1
148+
with:
149+
app-id: ${{ secrets.APP_ID }}
150+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
151+
repositories: |
152+
kernel-src-tree
153+
kernel-src-tree-tools
154+
166155
- name: Extract results and push branches
156+
env:
157+
PUSH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
167158
run: |
168159
cd kernel-src-tree
169160
@@ -175,6 +166,9 @@ jobs:
175166
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
176167
echo "Rebased to stable version: $STABLE_VERSION"
177168
169+
# Authenticate with the fresh token
170+
git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@github.com/${{ github.repository }}"
171+
178172
# Push the branches
179173
git push origin $CLK_NEXT_BRANCH
180174
git push origin $TMP_CLK_NEXT_BRANCH
@@ -215,7 +209,7 @@ jobs:
215209
- name: Fetch previous PR kselftest results
216210
if: success()
217211
env:
218-
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
212+
GH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
219213
run: |
220214
cd kernel-src-tree
221215
@@ -230,7 +224,7 @@ jobs:
230224
--state merged \
231225
--limit 10 \
232226
--json number,title,body,mergedAt \
233-
--jq "map(select(.title | contains(\"[CIQ ${CLK_VERSION}]\"))) | sort_by(.mergedAt) | reverse | .[0]")
227+
--jq "map(select(.title | contains(\"[CIQ ${CLK_VERSION}\"]))) | sort_by(.mergedAt) | reverse | .[0]")
234228
235229
if [ -n "$PREVIOUS_PR" ] && [ "$PREVIOUS_PR" != "null" ]; then
236230
# Extract the test count from the previous PR body
@@ -250,7 +244,7 @@ jobs:
250244
- name: Create Pull Request
251245
if: success()
252246
env:
253-
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
247+
GH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
254248
run: |
255249
cd kernel-src-tree
256250

0 commit comments

Comments
 (0)