Skip to content

Commit

Permalink
Improve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jsangmeister committed Feb 21, 2024
1 parent 06eaf89 commit 95fd5ed
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 55 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/create-pr-for-updates.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/create-pr.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/create-prs-for-updates.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/setup-autoupdate-pr.yml
Original file line number Diff line number Diff line change
@@ -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 ./...

0 comments on commit 95fd5ed

Please sign in to comment.