Skip to content
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

ci: auto merge main into the feature branch [skip ci] #1191

Merged
merged 5 commits into from
Jun 17, 2024
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/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Auto Merge Main into Feature Branch

# Automatically merge main into a feature branch when a pull request is labeled with 'autoupdate'

on:
pull_request:
types: [opened, synchronize, reopened, labeled]

jobs:
auto-merge:
if: contains(github.event.pull_request.labels.*.name, 'autoupdate')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Set up GPG key to extract the Git configuration
uses: crazy-max/ghaction-import-gpg@v3
id: import_gpg
with:
gpg-private-key: ${{ secrets.HYP_BOT_GPG_PRIVATE }}
passphrase: ${{ secrets.HYP_BOT_GPG_PASSWORD }}
git-user-signingkey: true
git-commit-gpgsign: true
git_config_global: true
git_tag_gpgsign: true

- name: Set up Git
run: |
git config --global user.name '${{ steps.import_gpg.outputs.name }}'
git config --global user.email '${{ steps.import_gpg.outputs.email }}'

- name: Fetch all branches
run: git fetch --all

- name: Checkout the feature branch
run: git checkout ${{ github.event.pull_request.head.ref }}

- name: Merge main into feature branch
run: git merge origin/main

- name: Push changes
run: git push origin ${{ github.event.pull_request.head.ref }}
if: success()

- name: Add comment to PR
if: success()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = ${{ github.event.pull_request.number }};
github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: 'The main branch has been successfully merged into this feature branch.'
});
1 change: 1 addition & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DISABLE_ERRORS_LINTERS:
- KOTLIN_KTLINT
- PROTOBUF_PROTOLINT
- MARKDOWN_MARKDOWN_LINK_CHECK
- ACTION_ACTIONLINT

DISABLE: [COPYPASTE, SPELL, CREDENTIALS]
SHOW_ELAPSED_TIME: false
Expand Down
Loading