Skip to content

Commit ffe2092

Browse files
committed
feat(pfd): integrate with github automations
1 parent b5a1a0f commit ffe2092

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Python/pip
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10
9+
# Apply specific labels to pull requests
10+
labels:
11+
- "dependencies"
12+
- "python"
13+
14+
# Enable version updates for Docker
15+
- package-ecosystem: "docker"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"
19+
open-pull-requests-limit: 10
20+
labels:
21+
- "dependencies"
22+
- "docker"
23+
24+
# Keep GitHub Actions up to date
25+
- package-ecosystem: "github-actions"
26+
directory: "/"
27+
schedule:
28+
interval: "weekly"
29+
open-pull-requests-limit: 10
30+
labels:
31+
- "dependencies"
32+
- "github-actions"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Auto-merge Dependabot PRs and Build Docker Image
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
pull_request_target:
7+
branches: [ master ]
8+
9+
jobs:
10+
auto-merge:
11+
runs-on: ubuntu-latest
12+
if: github.actor == 'dependabot[bot]'
13+
permissions:
14+
pull-requests: write
15+
contents: write
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Dependabot metadata
21+
id: metadata
22+
uses: dependabot/fetch-metadata@v2
23+
with:
24+
github-token: "${{ secrets.GITHUB_TOKEN }}"
25+
26+
- name: Auto-merge minor and patch updates
27+
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
28+
run: gh pr merge --auto --merge "$PR_URL"
29+
env:
30+
PR_URL: ${{github.event.pull_request.html_url}}
31+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
32+
33+
build-and-push:
34+
needs: auto-merge
35+
runs-on: ubuntu-latest
36+
if: github.event.pull_request.merged == true && github.actor == 'dependabot[bot]'
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
with:
42+
ref: main
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Login to DockerHub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ secrets.DOCKERHUB_USERNAME }}
51+
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v5
55+
with:
56+
push: true
57+
context: .
58+
tags: |
59+
lvthillo/python-flask-docker:latest
60+
lvthillo/python-flask-docker:${{ github.sha }}
61+
cache-from: type=gha
62+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)