Skip to content

Commit 67560f4

Browse files
authored
Add comment to workflow url in PR if a new kernel is available (#42)
1 parent a8d2a2f commit 67560f4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/pr-if-new-kernel.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
workflow_dispatch:
33
schedule:
4-
- cron: '0 0 * * *'
4+
- cron: '0 5 * * *'
55
jobs:
66
update:
77
runs-on: ubuntu-latest
@@ -28,8 +28,12 @@ jobs:
2828
git config --global user.email "gardenlinux@users.noreply.github.com"
2929
git commit -am 'Update kernel ${{ steps.update.outputs.has-update }}'
3030
git push --set-upstream origin update-kernel
31-
gh pr create --base main --head update-kernel --title 'Update kernel ${{ steps.update.outputs.has-update }}' --body "automated update" --reviewer fwilhe
31+
UPDATE_PR_LINK=$(gh pr create --base main --head update-kernel --title 'Update kernel ${{ steps.update.outputs.has-update }}' --body "automated update" --reviewer fwilhe)
32+
# We have to trigger our own workflow run because github does not do that when the pr is created by automation
33+
# This also means that we don't have the nice UI integration of test runs, so we add a comment to the workflow url for tracing purposes
3234
gh workflow run "build.yml" --ref "update-kernel"
35+
RUN_URL=$(gh run list --workflow=build.yml --limit=1 --json=url --jq='.[0].url')
36+
gh pr comment $UPDATE_PR_LINK --body "CI workflow created: $RUN_URL"
3337
fi
3438
env:
3539
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)