Skip to content

Commit

Permalink
GHA: move peter-evans/create-pull-request to GH CLI
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <[email protected]>
(cherry picked from commit 6013937)
  • Loading branch information
Vicente-Cheng committed Feb 11, 2025
1 parent 390f035 commit 161f22f
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions .github/workflows/installer-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,46 +37,43 @@ jobs:
echo "Diff $BASE_OS_IMAGE with ${{ env.IMAGE_NAME }}..."
container-diff diff daemon://docker.io/$BASE_OS_IMAGE daemon://docker.io/${{ env.IMAGE_NAME }} --type=rpm --output=diff-result.txt
cat diff-result.txt
- name: Set diff result to environment variable
run: |
echo "packagesDiff<<EOF" >> $GITHUB_ENV
cat diff-result.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Clone harvester-installer repo
uses: actions/checkout@v3
with:
repository: harvester/harvester-installer
ref: ${{ env.targetVersion }}
- name: Update os image
run: sed -i "s,^BASE_OS_IMAGE=.*,BASE_OS_IMAGE=\"${{ env.IMAGE_NAME }}\"," scripts/package-harvester-os
- name: Create installer PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: Bump OS ${{ inputs.tag }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
team-reviewers: os
signoff: false
branch: bump-os-${{ inputs.tag }}
delete-branch: true
title: 'Bump OS ${{ inputs.tag }}'
draft: false
body: |
**Problem:**
Harvester base OS needs to update.
**Solution:**
Bump OS image to [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ inputs.tag }}).
**Related Issue:**
**Test plan:**
- name: Create PR Content
run: |
echo "prContent<<EOF" >> $GITHUB_ENV
echo "**Problem:**" >> $GITHUB_ENV
echo "Harvester base OS needs to update." >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Solution:**" >> $GITHUB_ENV
echo "Bump OS image to [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ inputs.tag }})." >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Related Issue:**" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Test plan:**" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**More info:**" >> $GITHUB_ENV
cat diff-result.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
**More info:**
```
${{ env.packagesDiff }}
```
- name: Create installer PR
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
git add .
git commit -m "Bump OS ${{ inputs.tag }}" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push origin HEAD:bump-os-${{ inputs.tag }}
gh pr create \
--base {{ env.targetVersion }} \
--head bump-os-${{ inputs.tag }} \
--reviewer "harvester/os" \
--title "Bump OS ${{ inputs.tag }}" \
--body ${{ env.prContent }}
create-addon-pr:
runs-on: ubuntu-latest
Expand All @@ -92,27 +89,30 @@ jobs:
- name: Update nvidia driver toolkit tag
run: |
sed -i "/tag:/ {N; /harvester-nvidia-driver-toolkit/ s/tag:.*\n/tag: ${{ inputs.tag }}\n/}" pkg/templates/rancherd-22-addons.yaml
- name: Create Addons PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: Bump nvidia-driver-toolkit ${{ inputs.tag }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
team-reviewers: os
signoff: false
branch: bump-nv-driver-${{ inputs.tag }}
delete-branch: true
title: 'Bump nvidia-driver-toolkit ${{ inputs.tag }}'
draft: false
body: |
**Problem:**
The nvidia driver toolkit needs to update.
**Solution:**
Bump nvidia driver toolkit image as related baseos [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ inputs.tag }}).
**Related Issue:**
- name: create PR content
run: |
echo "prContent<<EOF" >> $GITHUB_ENV
echo "**Problem:**" >> $GITHUB_ENV
echo "The nvidia driver toolkit needs to update." >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Solution:**" >> $GITHUB_ENV
echo "Bump nvidia driver toolkit image as related baseos [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ inputs.tag }})." >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Related Issue:**" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "**Test plan:**" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
**Test plan:**
- name: Create Addons PR
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
git add .
git commit -m "Bump nvidia-driver-toolkit ${{ inputs.tag }}" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push origin HEAD:bump-nv-driver-${{ inputs.tag }}
gh pr create \
--base {{ env.targetVersion }} \
--head bump-nv-driver-${{ inputs.tag }} \
--reviewer "harvester/os" \
--title "Bump nvidia-driver-toolkit ${{ inputs.tag }}" \
--body ${{ env.prContent }} \

0 comments on commit 161f22f

Please sign in to comment.