diff --git a/.github/workflows/deploy-main-branches.yml b/.github/workflows/deploy-main-branches.yml index 3c09808ae..0375dc461 100644 --- a/.github/workflows/deploy-main-branches.yml +++ b/.github/workflows/deploy-main-branches.yml @@ -13,6 +13,7 @@ concurrency: jobs: detect-repo-owner: + name: Detect branch and appropriate server if: github.repository_owner == 'opencast' runs-on: ubuntu-latest outputs: @@ -36,6 +37,7 @@ jobs: deploy-main-branches: + name: Deploy editor.opencast.org runs-on: ubuntu-latest needs: detect-repo-owner steps: @@ -131,7 +133,7 @@ jobs: run: | git clone -b ${{ github.ref_name }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast cd opencast - git checkout -b t/editor-$GITHUB_REF + git checkout -b t/editor-${{ needs.detect-repo-owner.outputs.branch }} - name: Update the editor submodule working-directory: opencast @@ -142,17 +144,24 @@ jobs: # could end up causing the commit message, and the actual submodule hash to differ. git submodule update --init --remote modules/editor git add modules/editor - git commit -m "Updating editor to $GITHUB_REF" - git push origin t/editor-$GITHUB_REF + git commit -m "Updating editor to ${{ github.sha }}" # This token is an account wide token which allows creation of PRs and pushes. echo "${{ secrets.MODULE_PR_TOKEN }}" > token.txt gh auth login --with-token < token.txt - gh pr create \ - --title "Update ${{ needs.detect-repo-owner.outputs.branch }} Editor to $GITHUB_REF" \ - --body "Updating Opencast ${{ needs.detect-repo-owner.outputs.branch }} Editor module to [$GITHUB_REF](https://github.com/${{ github.repository_owner }}/editor/commit/$GITHUB_REF)" \ - --head=${{ github.repository_owner }}:t/editor-$GITHUB_REF \ - --base ${{ github.ref_name }} \ - -R ${{ github.repository_owner }}/opencast - #FIXME: fine grained PATs can't apply labels - #FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo - #--label editor --label maintenance \ + export CURRENT_PR=$(gh pr list -R ${{ github.repository_owner }}/opencast --head t/editor-${{ needs.detect-repo-owner.outputs.branch }} --json number --jq '.[].number') + git push origin t/editor-${{ needs.detect-repo-owner.outputs.branch }} --force + if [ -n "$CURRENT_PR" ]; then + gh pr edit $CURRENT_PR \ + --body "Updating Opencast ${{ needs.detect-repo-owner.outputs.branch }} Editor module to [${{ github.sha }}](https://github.com/${{ github.repository_owner }}/editor/commit/${{ github.sha }})" \ + -R ${{ github.repository_owner }}/opencast + else + gh pr create \ + --title "Update ${{ needs.detect-repo-owner.outputs.branch }} Editor" \ + --body "Updating Opencast ${{ needs.detect-repo-owner.outputs.branch }} Editor module to [${{ github.sha }}](https://github.com/${{ github.repository_owner }}/editor/commit/${{ github.sha }})" \ + --head=${{ github.repository_owner }}:t/editor-${{ needs.detect-repo-owner.outputs.branch }} \ + --base ${{ github.ref_name }} \ + -R ${{ github.repository_owner }}/opencast + #FIXME: fine grained PATs can't apply labels + #FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo + #--label editor --label maintenance \ + fi diff --git a/README.md b/README.md index 16eb184c4..8f920fb5d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Opencast Video Editor ===================== - +asdf [![Build & Deploy](https://github.com/opencast/opencast-editor/workflows/Build%20&%20Deploy/badge.svg) ](https://github.com/opencast/opencast-editor/actions?query=workflow%3A%22Build+%26+Deploy%22) [![Demo deployment](https://img.shields.io/badge/demo-editor.opencast.org-blue)