[DPE-5830] Bump to 24.04 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clone PR to test 24.04 base | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
clone-pr: | |
if: "!startsWith(github.event.pull_request.head.ref, '24.04-cloned')" # Skip if branch starts with "24.04-cloned" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
- name: Install tox | |
run: | | |
pipx install tox | |
- name: Run switch to 24.04 | |
run: | | |
tox run -e switch-24.04 | |
- name: Create and push to a new branch | |
run: | | |
NEW_BRANCH="24.04-cloned-${{ github.event.pull_request.number }}" | |
git checkout -b $NEW_BRANCH | |
git add . | |
git commit -m "switch to 24.04" | |
git push origin $NEW_BRANCH | |
- name: Create a pull request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
BASE_BRANCH="${{ github.event.pull_request.base.ref }}" | |
NEW_BRANCH="24.04-cloned-${{ github.event.pull_request.number }}" | |
PR_TITLE="Automated PR: 24.04 Changes from ${NEW_BRANCH}" | |
PR_BODY="This pull request was created automatically. Will test 24.04 base on the charm." | |
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --head "$NEW_BRANCH" --base "$BASE_BRANCH" --repo "${{ github.repository }}" |