-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (53 loc) · 2.18 KB
/
detect.yml
File metadata and controls
56 lines (53 loc) · 2.18 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
47
48
49
50
51
52
53
54
55
56
name: Detect Repo Contents
on:
workflow_call:
outputs:
has_yaml:
description: "app.yaml exists"
value: ${{ jobs.detect.outputs.has_yaml }}
has_tf:
description: "terraform/ directory exists"
value: ${{ jobs.detect.outputs.has_tf }}
has_docker:
description: "Dockerfile exists"
value: ${{ jobs.detect.outputs.has_docker }}
has_maven:
description: "pom.xml exists"
value: ${{ jobs.detect.outputs.has_maven }}
has_pnpm:
description: "pnpm-lock.yaml exists"
value: ${{ jobs.detect.outputs.has_pnpm }}
has_eb:
description: ".elasticbeanstalk/ directory exists"
value: ${{ jobs.detect.outputs.has_eb }}
app_name:
description: "App name from app.yaml (empty if no app.yaml)"
value: ${{ jobs.detect.outputs.app_name }}
jobs:
detect:
name: Detect Repo Contents
runs-on: ubuntu-latest
outputs:
has_yaml: ${{ steps.check.outputs.has_yaml }}
has_tf: ${{ steps.check.outputs.has_tf }}
has_docker: ${{ steps.check.outputs.has_docker }}
has_maven: ${{ steps.check.outputs.has_maven }}
has_pnpm: ${{ steps.check.outputs.has_pnpm }}
has_eb: ${{ steps.check.outputs.has_eb }}
app_name: ${{ steps.check.outputs.app_name }}
steps:
- uses: actions/checkout@v6
- name: Detect repo contents
id: check
run: |
echo "has_yaml=$(test -f app.yaml && echo true || echo false)" >> "$GITHUB_OUTPUT"
echo "has_tf=$(test -d terraform && echo true || echo false)" >> "$GITHUB_OUTPUT"
echo "has_docker=$(test -f Dockerfile && echo true || echo false)" >> "$GITHUB_OUTPUT"
echo "has_maven=$(test -f pom.xml && echo true || echo false)" >> "$GITHUB_OUTPUT"
echo "has_pnpm=$(test -f pnpm-lock.yaml && echo true || echo false)" >> "$GITHUB_OUTPUT"
echo "has_eb=$(test -d .elasticbeanstalk && echo true || echo false)" >> "$GITHUB_OUTPUT"
if [ -f app.yaml ]; then
echo "app_name=$(grep -m1 '^name:' app.yaml | awk '{print $2}' | tr -d '\"'"'")" >> "$GITHUB_OUTPUT"
else
echo "app_name=" >> "$GITHUB_OUTPUT"
fi