-
Notifications
You must be signed in to change notification settings - Fork 32
build: convert pr-automerge-open-release.yml to a reusable workflow #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c847ef1
build: .editorconfig files should be in every repo
nedbat 76f42a2
build: move pr-automerge-open-release to be a reusable workflow
nedbat 8db9c36
style(build): use more conventional yaml style
nedbat e479281
build(pr-automerge-open-release): use a hard-coded list of mergers
nedbat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| 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} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.