-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
148 additions
and
12 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Update Version and Create PR | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
repository: | ||
required: true | ||
type: string | ||
description: 'The target repository for the PR.' | ||
path: | ||
required: true | ||
type: string | ||
description: 'The path to check out the repository.' | ||
file_changes_script: | ||
required: true | ||
type: string | ||
description: 'The script to make file changes.' | ||
base_branch: | ||
required: true | ||
type: string | ||
description: 'The base branch to create the PR against.' | ||
|
||
jobs: | ||
create-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup SSH for Git operations | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.OBOL_PLATFORM_SSH_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
- name: Checkout target repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ssh-key: ${{ secrets.OBOL_PLATFORM_SSH_KEY }} | ||
path: ${{ inputs.path }} | ||
|
||
- name: Make changes in target repository | ||
run: | | ||
cd ${{ inputs.path }} | ||
${{ inputs.file_changes_script }} | ||
# Commit and push changes | ||
git config user.name "obol-platform" | ||
git config user.email "obol-platform@users.noreply.github.com" | ||
git checkout -b update-version-${{ github.event.inputs.tag_name }} | ||
git add . | ||
git commit -m "Update version to ${{ github.event.inputs.tag_name }}" | ||
git push origin update-version-${{ github.event.inputs.tag_name }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.OBOL_PLATFORM_PAT }} | ||
repository: ${{ inputs.repository }} | ||
base: ${{ inputs.base_branch }} | ||
head: update-version-${{ github.event.inputs.tag_name }} | ||
title: "Update version to ${{ github.event.inputs.tag_name }}" | ||
body: "Automatically generated PR to update version to ${{ github.event.inputs.tag_name }}" |