Skip to content

Commit 709ccf7

Browse files
committed
Update Dependabot
1 parent 1ad3f6e commit 709ccf7

File tree

3 files changed

+77
-34
lines changed

3 files changed

+77
-34
lines changed

.github/dependabot.yml

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
version: 2
2+
registries:
3+
ghcr:
4+
type: docker-registry
5+
url: ghcr.io
6+
username: ${{secrets.GHCR_USERNAME}}
7+
password: ${{secrets.GHCR_TOKEN}}
8+
9+
dockerhub:
10+
type: docker-registry
11+
url: registry-1.docker.io
12+
username: ${{secrets.DOCKERHUB_USER}}
13+
password: ${{secrets.DOCKERHUB_TOKEN}}
14+
15+
github-maven:
16+
type: maven-repository
17+
url: https://maven.pkg.github.com/${{github.repository_owner}}/*
18+
username: ${{secrets.GHCR_USERNAME}}
19+
password: ${{secrets.GHCR_TOKEN}}
220
updates:
321
# (Angular app)
422
- package-ecosystem: "npm"
@@ -10,40 +28,23 @@ updates:
1028
target-branch: "main"
1129
open-pull-requests-limit: 10
1230
labels: ["dependencies", "npm", "frontend"]
13-
# CHỈ chặn nâng major Angular (v21+), vẫn cho phép 20.x
1431
ignore:
1532
- dependency-name: "@angular/*"
1633
update-types: ["version-update:semver-major"]
1734
groups:
1835
angular-core:
19-
patterns:
20-
- "@angular/*"
21-
- "zone.js"
36+
patterns: ["@angular/*", "zone.js"]
2237
update-types: ["minor", "patch"]
2338
tooling-and-tests:
24-
patterns:
25-
- "typescript"
26-
- "karma*"
27-
- "jasmine*"
28-
- "@types/*"
29-
- "cypress"
39+
patterns: ["typescript", "karma*", "jasmine*", "@types/*", "cypress"]
3040
update-types: ["minor", "patch"]
3141
ui-and-md:
32-
patterns:
33-
- "highlight.js"
34-
- "marked"
35-
- "github-markdown-css"
36-
- "apexcharts"
37-
- "ng-apexcharts"
38-
- "ngx-*"
42+
patterns: ["highlight.js", "marked", "github-markdown-css", "apexcharts", "ng-apexcharts", "ngx-*"]
3943
update-types: ["minor", "patch"]
4044
codemirror-suite:
41-
patterns:
42-
- "codemirror"
43-
- "@codemirror/*"
45+
patterns: ["codemirror", "@codemirror/*"]
4446
update-types: ["minor", "patch"]
4547

46-
4748
# GitHub Actions
4849
- package-ecosystem: "github-actions"
4950
directory: "/"
@@ -59,6 +60,7 @@ updates:
5960
# Docker images (Nginx, Node…)
6061
- package-ecosystem: "docker"
6162
directory: "/docker"
63+
registries: ["ghcr", "dockerhub"]
6264
schedule:
6365
interval: "weekly"
6466
day: "tuesday"
@@ -69,16 +71,5 @@ updates:
6971
open-pull-requests-limit: 10
7072
groups:
7173
nginx-node-base:
72-
patterns:
73-
- "nginx"
74-
- "node"
75-
update-types: ["minor", "patch"]
76-
dotnet-base:
77-
patterns:
78-
- "mcr.microsoft.com/dotnet/*"
79-
update-types: ["minor", "patch"]
80-
jre-maven:
81-
patterns:
82-
- "eclipse-temurin:*"
83-
- "maven:*"
74+
patterns: ["nginx", "node"]
8475
update-types: ["minor", "patch"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Dependabot Auto-merge (minor & patch)
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, labeled]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
checks: read
11+
12+
jobs:
13+
auto-merge:
14+
if: github.actor == 'dependabot[bot]'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Fetch metadata
18+
id: meta
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Approve PR (minor/patch)
24+
if: |
25+
steps.meta.outputs.update-type == 'version-update:semver-minor' ||
26+
steps.meta.outputs.update-type == 'version-update:semver-patch'
27+
uses: peter-evans/approve-pull-request@v6
28+
with:
29+
pull-request-number: ${{ github.event.pull_request.number }}
30+
review-message: "Auto-approved by workflow for minor/patch updates."
31+
32+
- name: Enable auto-merge (squash)
33+
if: |
34+
steps.meta.outputs.update-type == 'version-update:semver-minor' ||
35+
steps.meta.outputs.update-type == 'version-update:semver-patch'
36+
uses: peter-evans/enable-pull-request-automerge@v3
37+
with:
38+
pull-request-number: ${{ github.event.pull_request.number }}
39+
merge-method: squash

.github/workflows/frontend-docker-publish.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ permissions:
1919
packages: write
2020

2121
env:
22+
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/codecampus-frontend
2223
DOCKER_REPO: ${{ secrets.DOCKERHUB_USER }}/codecampus-frontend
2324
DOCKERFILE_PATH: docker/angular-frontend.Dockerfile
2425
PLATFORMS: linux/amd64
@@ -41,19 +42,30 @@ jobs:
4142
id: meta
4243
run: |
4344
TAGS=""
45+
TAGS_GHCR=""
4446
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
4547
VERSION="${GITHUB_REF_NAME#v}"
4648
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
4749
TAGS="${{ env.DOCKER_REPO }}:${VERSION}"
50+
TAGS_GHCR="${{ env.GHCR_REPO }}:${VERSION}"
4851
else
4952
SHA_TAG="${GITHUB_SHA::12}"
5053
echo "IMAGE_TAG=${SHA_TAG}" >> $GITHUB_ENV
5154
TAGS="${{ env.DOCKER_REPO }}:${SHA_TAG}"
55+
TAGS_GHCR="${{ env.GHCR_REPO }}:${SHA_TAG}"
5256
if [ "${GITHUB_REF_NAME}" = "main" ]; then
5357
TAGS="${TAGS},${{ env.DOCKER_REPO }}:latest"
58+
TAGS_GHCR="${TAGS_GHCR},${{ env.GHCR_REPO }}:latest"
5459
fi
5560
fi
56-
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
61+
echo "tags=${TAGS},${TAGS_GHCR}" >> $GITHUB_OUTPUT
62+
63+
- name: Login to GHCR
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
5769

5870
- name: Login to Docker Hub
5971
uses: docker/login-action@v3
@@ -71,3 +83,4 @@ jobs:
7183
tags: ${{ steps.meta.outputs.tags }}
7284
cache-from: type=gha
7385
cache-to: type=gha,mode=max
86+

0 commit comments

Comments
 (0)