Skip to content

Commit 692f3ca

Browse files
authored
Update and rename App_Header_Merge_Into_main.yaml to auto-update-app-headers.yml
1 parent 3830527 commit 692f3ca

File tree

2 files changed

+63
-66
lines changed

2 files changed

+63
-66
lines changed

.github/workflows/App_Header_Merge_Into_main.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Auto Update .app-headers with Hard Merge from Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'ct/**.sh'
9+
10+
jobs:
11+
auto-update:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Step 1: Checkout repository
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
# Step 2: Set up Git user
19+
- name: Set up Git
20+
run: |
21+
git config --global user.name "GitHub Actions"
22+
git config --global user.email "[email protected]"
23+
24+
# Step 3: Reset update-app-headers to main
25+
- name: Reset update-app-headers branch to main
26+
run: |
27+
git checkout -B update-app-headers origin/main
28+
echo "Branch update-app-headers reset to match main"
29+
30+
# Step 4: Ensure .app-headers file exists
31+
- name: Ensure .app-headers file exists
32+
run: |
33+
touch ct/.app-headers
34+
35+
# Step 5: Update .app-headers with figlet output
36+
- name: Update .app-headers
37+
run: |
38+
output_file="./ct/.app-headers"
39+
> "$output_file" # Clear or create the file
40+
41+
current_date=$(date +"%m-%d-%Y")
42+
echo "### Generated on $current_date" >> "$output_file"
43+
echo "##################################################" >> "$output_file"
44+
echo >> "$output_file"
45+
46+
find ./ct -type f -name "*.sh" | sort | while read -r script; do
47+
app_name=$(grep -oP '^APP="\K[^"]+' "$script" 2>/dev/null)
48+
49+
if [[ -n "$app_name" ]]; then
50+
figlet_output=$(figlet -f slant "$app_name" 2>/dev/null || echo "FIGLET ERROR: $app_name")
51+
echo "### $(basename "$script")" >> "$output_file"
52+
echo "APP=$app_name" >> "$output_file"
53+
echo "$figlet_output" >> "$output_file"
54+
echo >> "$output_file"
55+
fi
56+
done
57+
58+
# Step 6: Commit and push changes
59+
- name: Commit and push changes
60+
run: |
61+
git add ct/.app-headers
62+
git commit -m "Update .app-headers on $(date +"%Y-%m-%d")" || echo "No changes to commit"
63+
git push --force origin update-app-headers

0 commit comments

Comments
 (0)