-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (41 loc) · 1.73 KB
/
_pullRequest.yml
File metadata and controls
46 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Pull Request
on:
pull_request:
paths:
- 'actions/**/Dockerfile'
- 'actions/**/*.go'
- 'actions/**/go.mod'
- 'actions/**/go.sum'
- 'actions/**/action.yml'
jobs:
FindActionDockerfiles:
name: Find Action Dockerfiles
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.find-dockerfiles.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find Dockerfiles in actions
id: find-dockerfiles
run: |
dockerfiles=$(find actions -name "Dockerfile" -type f -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')
echo "matrix={\"actionPath\":$dockerfiles}" >> $GITHUB_OUTPUT
echo "Found action paths with Dockerfiles: $dockerfiles"
ValidateDockerBuilds:
name: Validate Docker Build
runs-on: ubuntu-latest
needs: FindActionDockerfiles
if: needs.FindActionDockerfiles.outputs.matrix != '{"actionPath":[]}'
strategy:
matrix: ${{ fromJson(needs.FindActionDockerfiles.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker Image (No Push)
run: |
cd "${{ matrix.actionPath }}"
action_name=$(basename "${{ matrix.actionPath }}" | tr '[:upper:]' '[:lower:]')
echo "Building Docker image for action: $action_name"
docker build -t test-$action_name:pr-${{ github.event.pull_request.number }} .
echo "✅ Docker build successful for $action_name"