Skip to content

Commit 2724fce

Browse files
authored
Merge branch 'master' into renovate/data_migrate-11.x
2 parents 1fc63d4 + 6147ed0 commit 2724fce

File tree

5 files changed

+67
-86
lines changed

5 files changed

+67
-86
lines changed

.codeclimate.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/auto-merge.yml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ permissions:
1212
jobs:
1313
auto-approve-merge:
1414
runs-on: ubuntu-latest
15-
if: (github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]') && github.repository == 'internetee/registry'
1615
steps:
1716
- name: Checkout repository
17+
if: github.repository == 'internetee/registry'
1818
uses: actions/checkout@v5
1919

2020
- name: Install GitHub CLI
2121
run: |
22-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
23-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
24-
sudo apt update
25-
sudo apt install gh
22+
sudo apt-get update
23+
sudo apt-get install -y gh
2624
2725
- name: Auto approve PR
26+
if: |
27+
github.actor == 'dependabot[bot]' ||
28+
github.actor == 'renovate[bot]'
2829
uses: hmarr/auto-approve-action@v3
2930
with:
3031
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -39,29 +40,36 @@ jobs:
3940
- name: Check if PR should be auto-merged
4041
id: check_auto_merge
4142
run: |
43+
# Set default UPDATE_TYPE to avoid unbound variable errors
44+
UPDATE_TYPE="${{ steps.metadata.outputs.update-type || 'unknown' }}"
45+
4246
if [ "${{ github.actor }}" == "dependabot[bot]" ]; then
43-
if [[ "${{ steps.metadata.outputs.update-type }}" == "version-update:semver-patch" ]]; then
47+
if [[ "$UPDATE_TYPE" == "version-update:semver-patch" ]]; then
4448
echo "auto_merge=true" >> $GITHUB_OUTPUT
49+
echo "update_type=${UPDATE_TYPE}" >> $GITHUB_OUTPUT
4550
echo "Auto-merge: Dependabot patch update detected"
4651
else
4752
echo "auto_merge=false" >> $GITHUB_OUTPUT
53+
echo "update_type=${UPDATE_TYPE}" >> $GITHUB_OUTPUT
4854
echo "Auto-merge: Dependabot non-patch update, skipping"
4955
fi
5056
elif [ "${{ github.actor }}" == "renovate[bot]" ]; then
51-
# Check if PR has patch label (set by renovate.json configuration)
52-
# Extract label names from the labels array
53-
LABEL_NAMES=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name' | tr '\n' ' ')
54-
if [[ "$LABEL_NAMES" == *"patch"* ]] || [[ "$LABEL_NAMES" == *"bundler"* ]] || [[ "$LABEL_NAMES" == *"ruby-version"* ]] || [[ "$LABEL_NAMES" == *"github-actions"* ]]; then
57+
# Check if the PR has the 'patch' label but NOT 'minor' or 'major' labels
58+
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | tr '\n' ' ')
59+
if [[ "$LABELS" == *"patch"* ]] && [[ "$LABELS" != *"minor"* ]] && [[ "$LABELS" != *"major"* ]]; then
5560
echo "auto_merge=true" >> $GITHUB_OUTPUT
56-
echo "Auto-merge: Renovate patch update detected (label-based): $LABEL_NAMES"
61+
echo "update_type=renovate-patch-only" >> $GITHUB_OUTPUT
5762
else
5863
echo "auto_merge=false" >> $GITHUB_OUTPUT
59-
echo "Auto-merge: Renovate non-patch update, skipping. Labels: $LABEL_NAMES"
64+
echo "update_type=renovate-non-patch-or-mixed" >> $GITHUB_OUTPUT
6065
fi
6166
else
6267
echo "auto_merge=false" >> $GITHUB_OUTPUT
68+
echo "update_type=${UPDATE_TYPE}" >> $GITHUB_OUTPUT
6369
echo "Auto-merge: Unknown actor, skipping"
6470
fi
71+
env:
72+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6573
shell: bash
6674

6775
- name: Wait for CI checks
@@ -82,13 +90,4 @@ jobs:
8290
}
8391
env:
8492
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85-
86-
- name: Send Mattermost notification
87-
if: steps.check_auto_merge.outputs.auto_merge == 'true'
88-
run: |
89-
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
90-
curl -X POST -H "Authorization: Bearer ${{ secrets.MATTERMOST_BOT_TOKEN }}" \
91-
-H "Content-Type: application/json" \
92-
-d "{\"channel_id\":\"${{ secrets.MATTERMOST_CHANNEL_ID }}\",\"message\":\"[${{ github.repository }}] PR #${{ github.event.pull_request.number }}: \\\"${{ github.event.pull_request.title }}\\\" was auto-merged by ${{ github.actor }}.\nUpdate type: ${{ steps.metadata.outputs.update-type || 'patch' }}\nMerged at: $TIMESTAMP\nLink: ${{ github.event.pull_request.html_url }}\"}" \
93-
https://mattermost.example.com/api/v4/posts
9493

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Notify Auto-Merged PRs
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Auto approve & merge Dependabot and Renovate PRs"]
6+
types: [completed]
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
jobs:
14+
notify:
15+
if: github.event.workflow_run.conclusion == 'success'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Send Mattermost notification
19+
env:
20+
MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }}
21+
MATTERMOST_CHANNEL_ID: ${{ secrets.MATTERMOST_CHANNEL_ID }}
22+
MATTERMOST_BASE_URL: ${{ secrets.MATTERMOST_BASE_URL }}
23+
REPO: ${{ github.repository }}
24+
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
25+
WORKFLOW_URL: ${{ github.event.workflow_run.html_url }}
26+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
27+
BRANCH: ${{ github.event.workflow_run.head_branch }}
28+
run: |
29+
if [ -z "$MATTERMOST_BOT_TOKEN" ] || [ -z "$MATTERMOST_CHANNEL_ID" ] || [ -z "$MATTERMOST_BASE_URL" ]; then
30+
echo "Missing Mattermost secrets (MATTERMOST_BOT_TOKEN, MATTERMOST_CHANNEL_ID, MATTERMOST_BASE_URL)" >&2
31+
exit 1
32+
fi
33+
curl -sS -X POST \
34+
-H "Authorization: Bearer $MATTERMOST_BOT_TOKEN" \
35+
-H "Content-Type: application/json" \
36+
-d "{\"channel_id\":\"$MATTERMOST_CHANNEL_ID\",\"message\":\"🤖 [$REPO] Auto-merge workflow completed successfully!\\nWorkflow: $WORKFLOW_NAME\\nBranch: $BRANCH\\nCommit: $COMMIT_SHA\\nLink: $WORKFLOW_URL\"}" \
37+
"$MATTERMOST_BASE_URL/api/v4/posts"

.github/workflows/ruby.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ jobs:
6464
files: coverage/.resultset.json
6565

6666
- uses: actions/upload-artifact@v4
67+
if: always()
6768
with:
6869
name: coverage
69-
path: coverage/
70+
path: |
71+
coverage/.resultset.json
72+
coverage/index.html
73+
coverage/assets/
74+
include-hidden-files: true

renovate.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"packageRules": [
66
{
77
"matchUpdateTypes": ["patch", "pin", "digest"],
8-
"automerge": true,
8+
"automerge": false,
99
"automergeType": "pr",
1010
"addLabels": ["patch", "dependencies"],
1111
"requiredStatusChecks": null
@@ -24,7 +24,7 @@
2424
"matchDepTypes": ["ruby", "bundler", "Gemfile", "Gemfile.lock"],
2525
"matchUpdateTypes": ["patch"],
2626
"addLabels": ["bundler", "dependencies"],
27-
"automerge": true,
27+
"automerge": false,
2828
"automergeType": "pr",
2929
"requiredStatusChecks": null
3030
},
@@ -38,7 +38,7 @@
3838
"matchDepTypes": [".ruby-version"],
3939
"matchUpdateTypes": ["patch"],
4040
"addLabels": ["ruby-version", "dependencies"],
41-
"automerge": true,
41+
"automerge": false,
4242
"automergeType": "pr",
4343
"requiredStatusChecks": null
4444
},
@@ -52,7 +52,7 @@
5252
"matchFileNames": [".github/workflows/ruby.yml"],
5353
"matchUpdateTypes": ["patch", "minor"],
5454
"addLabels": ["github-actions", "dependencies"],
55-
"automerge": true,
55+
"automerge": false,
5656
"automergeType": "pr",
5757
"requiredStatusChecks": null
5858
}

0 commit comments

Comments
 (0)