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
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is a file to standardize editor settings: http://EditorConfig.org

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
max_line_length = 120
trim_trailing_whitespace = true

[{Makefile, *.mk}]
# Makefiles need tabs
indent_style = tab
indent_size = 8

[*.{yml,yaml,json}]
indent_size = 2

[*.js]
indent_size = 2

[*.diff]
# Git patches need whitespace in first column for empty lines.
trim_trailing_whitespace = false

[.git/*]
# Don't fiddle with .git files at all.
trim_trailing_whitespace = false

[COMMIT_EDITMSG]
max_line_length = 72

[*.rst]
max_line_length = 79
73 changes: 73 additions & 0 deletions .github/workflows/pr-automerge-open-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# For non-draft changes to named release branches:
# - Check if the user is a maintainer (listed below in the MERGERS env var).
# - If so, approve the pull request.
# - Merge the PR when the author comments `@openedx-community-bot merge`.
#
# Required organization secrets
# - CC_GITHUB_TOKEN

name: Automerge BTR open-release PRs

env:
# The GitHub user names of people allowed to tell the bot to merge.
# From the "All release branches" entries on the wiki:
# https://openedx.atlassian.net/wiki/spaces/COMM/pages/3156344833/Current+Core+Contributors
MERGERS: arbrandes BbrSofiane cmltaWt0 regisb

on:
# This action is meant to be used from other actions.
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
- workflow_call
Comment thread
nedbat marked this conversation as resolved.

defaults:
run:
shell: bash

jobs:
automerge:
if: ${{ (github.event.issue.pull_request && !github.event.issue.pull_request.draft) || (github.event.pull_request && !github.event.pull_request.draft) }}
runs-on: ubuntu-latest
steps:
- name: Check merge rights
id: check
# This workflow used to use tspascoal/get-user-teams-membership,
# but it stopped working, and this works.
run: |
set -x
if echo $MERGERS | grep -q -w ${{ github.actor }}; then
permok=true
else
permok=false
fi
echo "PERMOK=$permok" >> $GITHUB_ENV

- name: Approve PR
if: ${{ env.PERMOK == 'true' && (github.event.action == 'opened' || github.event.action == 'ready_for_review') }}
uses: andrewmusgrave/[email protected]
with:
repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
event: APPROVE
body: |
:+1:

When you're ready to merge, add a comment that says
> @openedx-community-bot merge

and we'll handle the rest!

- name: Label PR as auto-mergeable
if: ${{ env.PERMOK == 'true' && contains(github.event.comment.body, '@openedx-community-bot merge') }}
uses: andymckay/[email protected]
with:
add-labels: 'automerge'
repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

- name: Automerge
if: ${{ env.PERMOK == 'true' }}
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}"
MERGE_COMMIT_MESSAGE: |
merge(#{pullRequest.number}): {pullRequest.title}

{pullRequest.body}
60 changes: 12 additions & 48 deletions workflow-templates/pr-automerge-open-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,24 @@
# - CC_TEAM_CHAMPIONS=org/team-name
# - CC_TEAM_CONTRIBUTORS_ORG=org
# - CC_TEAM_CONTRIBUTORS_TEAM=team-name
---
name: automerge BTR open-release PRs

name: Automerge BTR open-release PRs

on:
issue_comment:
branches:
- open-release/*
- open-release/*
types:
- created
- edited
- created
- edited
pull_request_target:
branches:
- open-release/*
- open-release/*
types:
- opened
- edited
- ready_for_review
- opened
- edited
- ready_for_review

jobs:
automerge:
if: ${{ (github.event.issue.pull_request && !github.event.issue.pull_request.draft) || (github.event.pull_request && !github.event.pull_request.draft) }}
runs-on: ubuntu-latest
steps:
- name: lookup teams
id: teams
uses: tspascoal/get-user-teams-membership@v1
with:
username: "${{ github.actor }}"
organization: ${{ secrets.CC_TEAM_CONTRIBUTORS_ORG }}
team: ${{ secrets.CC_TEAM_CONTRIBUTORS_TEAM }}
GITHUB_TOKEN: "${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}"
- name: approve PR
if: ${{ steps.teams.outputs.isTeamMember == 'true' && (github.event.action == 'opened' || github.event.action == 'ready_for_review') }}
uses: andrewmusgrave/[email protected]
with:
repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
event: APPROVE
body: |
:+1:

When you're ready to merge, add a comment that says
> @edx-community-bot merge

and we'll handle the rest!
CC: @${{ secrets.CC_TEAM_CHAMPIONS }} @${{ secrets.CC_TEAM_CONTRIBUTORS_ORG }}/${{ secrets.CC_TEAM_CONTRIBUTORS_TEAM }}
- name: label PR as auto-mergeable
if: ${{ steps.teams.outputs.isTeamMember == 'true' && contains(github.event.comment.body, '@edx-community-bot merge') }}
uses: andymckay/labeler@978f846c4ca6299fd136f465b42c5e87aca28cac
with:
add-labels: 'automerge'
repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}"
MERGE_COMMIT_MESSAGE: |
merge(#{pullRequest.number}): {pullRequest.title}

{pullRequest.body}
uses: openedx/.github/.github/workflows/pr-automerge-open-release.yml@master