Skip to content

Commit

Permalink
Add sync workflow for OPAL+ repository (#630)
Browse files Browse the repository at this point in the history
* Added sync OPAL+ workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow

* Changed OPAL+ sync workflow
  • Loading branch information
danyi1212 authored Jul 28, 2024
1 parent 6395f05 commit bd0777c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/sync_opal_plus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Sync branch to OPAL Plus

on:
push:
branches:
- master
workflow_dispatch:

jobs:
sync:
name: Sync branch to OPAL Plus
if: github.repository == 'permitio/opal'
runs-on: ubuntu-latest
steps:
- name: Set up Git configuration
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}

- name: Checkout permitio/opal repository
uses: actions/checkout@v4
with:
repository: permitio/opal
ref: ${{ github.ref_name }}
path: opal
fetch-depth: 0

- name: Checkout permitio/opal-plus repository
uses: actions/checkout@v4
with:
repository: permitio/opal-plus
path: opal-plus
token: ${{ steps.get_workflow_token.outputs.token }}

- name: Create public-${{ github.ref_name }} branch in opal repository
working-directory: opal
run: |
git checkout -b public-${{ github.ref_name }}
- name: Rebase opal-plus/public-${{ github.ref_name }} onto opal/${{ github.ref_name }}
working-directory: opal-plus
run: |
git remote add opal ../opal
git fetch opal
git checkout public-${{ github.ref_name }}
git rebase opal/${{ github.ref_name }}
- name: Push changes to opal-plus/public-${{ github.ref_name }} branch
working-directory: opal-plus
run: |
git push origin public-${{ github.ref_name }}
- name: Create Pull Request for opal-plus
working-directory: opal-plus
run: |
gh pr create --repo permitio/opal-plus --assignee "$GITHUB_ACTOR" --reviewer "$GITHUB_ACTOR" --base master --head public-${{ github.ref_name }} --title "Sync changes from public OPAL repository" --body "This PR synchronizes changes from the public OPAL repository to the private OPAL Plus repository."
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}

0 comments on commit bd0777c

Please sign in to comment.