diff --git a/.github/workflows/create-pr-for-updates.yml b/.github/workflows/create-pr-for-updates.yml deleted file mode 100644 index f80dbf6e..00000000 --- a/.github/workflows/create-pr-for-updates.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: Create PRs on each update -on: - push: - branches: - - main - -jobs: - announce-update: - name: 'Announce updates' - runs-on: ubuntu-latest - if: github.repository_owner == 'OpenSlides' - env: - EVENT_TYPE: meta-update - PAYLOAD: '{"commit": "${{ github.sha }}"}' - - steps: - - name: Generate access token - uses: tibdex/github-app-token@v2 - id: generate-token - with: - app_id: ${{ secrets.AUTOMATION_APP_ID }} - private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} - - - name: Send dispatch to autoupdate service - uses: peter-evans/repository-dispatch@v3 - with: - event-type: ${{ env.EVENT_TYPE }} - repository: ${{ github.repository_owner }}/openslides-autoupdate-service - token: ${{ steps.generate-token.outputs.token }} - client-payload: ${{ env.PAYLOAD }} - - - name: Send dispatch to backend - uses: peter-evans/repository-dispatch@v3 - with: - event-type: ${{ env.EVENT_TYPE }} - repository: ${{ github.repository_owner }}/openslides-backend - token: ${{ steps.generate-token.outputs.token }} - client-payload: ${{ env.PAYLOAD }} - - - name: Send dispatch to client - uses: peter-evans/repository-dispatch@v3 - with: - event-type: ${{ env.EVENT_TYPE }} - repository: ${{ github.repository_owner }}/openslides-client - token: ${{ steps.generate-token.outputs.token }} - client-payload: ${{ env.PAYLOAD }} - - - name: Send dispatch to search service - uses: peter-evans/repository-dispatch@v3 - with: - event-type: ${{ env.EVENT_TYPE }} - repository: ${{ github.repository_owner }}/openslides-search-service - token: ${{ steps.generate-token.outputs.token }} - client-payload: ${{ env.PAYLOAD }} diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml new file mode 100644 index 00000000..c5c935b9 --- /dev/null +++ b/.github/workflows/create-pr.yml @@ -0,0 +1,62 @@ +name: Create pull request in remote repository +on: + workflow_call: + inputs: + repository: + required: true + type: string + commit: + required: true + type: string + assignee: + required: true + type: string + setup-action: + type: string + secrets: + AUTOMATION_APP_ID: + required: true + AUTOMATION_APP_PRIVATE_KEY: + required: true + +jobs: + workflow_call: + name: Create or update PR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: OpenSlides/${{ inputs.repository }} + fetch-depth: 0 + submodules: true + + - name: Checkout meta repository commit + working-directory: .git/modules/openslides-meta/ + run: git fetch origin && git checkout ${{ inputs.commit }} + + - name: Update repository files + if: inputs.setup-action != '' + uses: jenseng/dynamic-uses@v1 + with: + uses: ./.github/actions/${{ inputs.setup-action }} + + - name: Generate access token + uses: tibdex/github-app-token@v2 + id: generate-token + with: + app_id: ${{ secrets.AUTOMATION_APP_ID }} + private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + + - name: Create or update PR + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ steps.generate-token.outputs.token }} + commit-message: Update meta repository + branch: dep/update-meta-repo + delete-branch: true + title: Update meta repository + body: "Triggered by commit [${{ inputs.commit }}](https://github.com/OpenSlides/openslides-meta/commit/${{ inputs.commit }})" + reviewers: ${{ inputs.assignee }} + assignees: ${{ inputs.assignee }} + labels: dependencies + milestone: 4 diff --git a/.github/workflows/create-prs-for-updates.yml b/.github/workflows/create-prs-for-updates.yml new file mode 100644 index 00000000..f86da0d5 --- /dev/null +++ b/.github/workflows/create-prs-for-updates.yml @@ -0,0 +1,30 @@ +--- +name: Create PRs on each update +on: + push: + branches: + - main + +jobs: + create-pull-requests: + name: Create PR for autoupdate service + if: github.repository_owner == 'OpenSlides' + uses: ./.github/workflows/create-pr.yml + with: + repository: ${{ matrix.repository }} + commit: ${{ github.sha }} + assignee: ${{ matrix.assignee }} + setup-action: ${{ matrix.setup-action }} + secrets: inherit + strategy: + matrix: + include: + - repository: openslides-autoupdate-service + assignee: ostcar + setup-action: setup-autoupdate-pr + - repository: openslides-backend + assignee: jsangmeister + - repository: openslides-client + assignee: bastianjoel + - repository: openslides-search-service + assignee: bastianjoel diff --git a/.github/workflows/setup-autoupdate-pr.yml b/.github/workflows/setup-autoupdate-pr.yml new file mode 100644 index 00000000..41a12e0a --- /dev/null +++ b/.github/workflows/setup-autoupdate-pr.yml @@ -0,0 +1,12 @@ +name: Prepare meta update PR in autoupdate repo + +runs: + using: "composite" + steps: + - name: Set up go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Run go generate + run: go generate ./...