From cd2fa230f7cfebca77bd928338adfca8ad582710 Mon Sep 17 00:00:00 2001 From: Pranav Kumar Mishra <62562712+pranavmishra90@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:30:39 -0600 Subject: [PATCH] feat: add github action to update the develop branch when a new commit to main is made --- .github/workflows/merge-main-onto-develop.yml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/merge-main-onto-develop.yml diff --git a/.github/workflows/merge-main-onto-develop.yml b/.github/workflows/merge-main-onto-develop.yml new file mode 100644 index 0000000..84ba60d --- /dev/null +++ b/.github/workflows/merge-main-onto-develop.yml @@ -0,0 +1,45 @@ +name: Merge Main onto Develop + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + update-develop: + runs-on: ubuntu-latest + + # This action should only run on the main repository, not forks + if: ${{ github.repository == 'FacsimiLab/facsimilab-platform' }} # Only run on main repository + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + show-progress: true + set-safe-directory: '/' + + - name: Read the image version + id: package + uses: juliangruber/read-file-action@v1 + with: + path: ${{ github.workspace }}/docker/image_version.txt + + - name: Merge Main onto Develop + run: | + git checkout develop + git merge main --no-edit + git push origin develop + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Matrix Message - Completed GitHub Action + uses: s3krit/matrix-message-action@v0.0.3 + with: + room_id: ${{ secrets.MATRIX_ROOM_ID }} + access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + message: "FacsimiLab ${{ steps.package.outputs.content }} - Updated the `develop` branch from `main` at https://github.com/FacsimiLab/facsimilab-platform" + server: "matrix.drpranavmishra.com" \ No newline at end of file