Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/cherry-pick-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Cherry pick staging PRs merged into main
on:
pull_request_target:
types:
- closed
branches:
- "main"
jobs:
create-pr-for-staging:
if: |
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'staging')
name: Create PR against staging branch
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 2

- name: Fetch and checkout latest staging branch
run: |
branch=$(git ls-remote --heads origin 'staging/*' | awk 'gsub(".*refs/heads/","")' | sort -V | tail -1)
git fetch origin $branch
git checkout $branch

- name: Set git credentials
run: |
git config --global user.name openslides-automation
git config --global user.email openslides-automation@users.noreply.github.com

- name: Cherry-pick new commit
id: cherry-pick
run: |
git fetch origin
# -m 1 to also be able to cherry-pick merge commits
git cherry-pick -m 1 ${{ github.sha }} || {
echo "error=1" >> $GITHUB_OUTPUT
git add .
git cherry-pick --continue
}

- name: Generate access token
uses: actions/create-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@v8
with:
token: ${{ steps.generate-token.outputs.token }}
branch: apply/commit-${{ github.sha }}
delete-branch: true
title: "[Cherry-Pick] ${{ github.event.pull_request.title }}"
body: "Triggered by commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n${{ steps.cherry-pick.outputs.error && 'There were conflicts during the cherry-pick. These were commited without any resolving. Please resolve them manually and push the result to this branch before merging.' || 'The cherry-pick was successful without any conflicts. You should be able to simply merge this PR.' }}"
reviewers: ${{ github.event.pull_request.user.login }}
assignees: ${{ github.event.pull_request.user.login }}
labels: picked-to-staging
52 changes: 52 additions & 0 deletions .github/workflows/close-issue-on-feature-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Close issues on feature branch merge
on:
pull_request_target:
types:
- closed
branches:
- "feature/*"
jobs:
close-issue:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
- name: Generate access token
uses: actions/create-github-app-token@v2
id: generate-token
with:
app-id: ${{ secrets.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}

- uses: octokit/graphql-action@v3
id: get-issues
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
query: |
query getLinkedIssues($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
closingIssuesReferences(first: 100) {
nodes {
number
repository {
nameWithOwner
}
}
}
}
}
}
variables: |
owner: ${{ github.repository_owner }}
name: ${{ github.event.repository.name }}
number: ${{ github.event.pull_request.number }}

- name: Close issues
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
issue_data="$(echo '${{ steps.get-issues.outputs.data }}' | jq -r '.repository.pullRequest.closingIssuesReferences.nodes[] | [.number,.repository.nameWithOwner] | @tsv')"
echo "$issue_data" | grep -v "^$" | while read number nameWithOwner; do
gh issue close "$number" -r "$nameWithOwner"
done
13 changes: 13 additions & 0 deletions .github/workflows/project-automation-issue-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Project automation
on:
issues:
types:
- closed
jobs:
issue_closed:
name: Issue closed
uses: ./.github/workflows/project-automation.yml
secrets: inherit
with:
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Done"
14 changes: 14 additions & 0 deletions .github/workflows/project-automation-issue-opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Project automation
on:
issues:
types:
- opened
- reopened
jobs:
issue_opened:
name: Issue opened
uses: ./.github/workflows/project-automation.yml
secrets: inherit
with:
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Backlog"
13 changes: 13 additions & 0 deletions .github/workflows/project-automation-pr-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Project automation
on:
pull_request_target:
types:
- closed
jobs:
pull_request_closed:
name: Pull request closed
uses: ./.github/workflows/project-automation.yml
secrets: inherit
with:
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "Done"
14 changes: 14 additions & 0 deletions .github/workflows/project-automation-pr-opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Project automation
on:
pull_request_target:
types:
- opened
- reopened
jobs:
pull_request_opened:
name: Pull request opened
uses: ./.github/workflows/project-automation.yml
secrets: inherit
with:
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "Work in progress"
13 changes: 13 additions & 0 deletions .github/workflows/project-automation-pr-review-requested.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Project automation
on:
pull_request_target:
types:
- review_requested
jobs:
pull_request_review_requested:
name: Pull request review requested
uses: ./.github/workflows/project-automation.yml
secrets: inherit
with:
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "Review in progress"
28 changes: 28 additions & 0 deletions .github/workflows/project-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Project automation
on:
workflow_call:
inputs:
resource_node_id:
required: true
type: string
status_value:
required: true
type: string
secrets:
AUTOMATION_APP_ID:
required: true
AUTOMATION_APP_PRIVATE_KEY:
required: true
jobs:
workflow_call:
name: Set status
runs-on: ubuntu-latest
steps:
- uses: leonsteinhaeuser/project-beta-automations@v2.2.1
with:
gh_app_ID: ${{ secrets.AUTOMATION_APP_ID }}
gh_app_secret_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
organization: OpenSlides
project_id: 2
resource_node_id: ${{ inputs.resource_node_id }}
status_value: ${{ inputs.status_value }}
Loading