-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (62 loc) · 2.21 KB
/
Copy pathnightly-update.yml
File metadata and controls
75 lines (62 loc) · 2.21 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Nightly Data Update
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Run generate command
run: go run . generate
env:
AWSMETA_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for changes and commit
id: git-diff
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Only add files that should be updated by the generate command
git add pkg/data/manifests/ go.mod go.sum
if git diff --cached --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "📊 No changes detected in AWS data"
else
current_date=$(date +'%Y-%m-%d')
cat > commit_message.txt << EOF
chore(data): ⏳nightly AWS data update ($current_date)
- Updated partition data
- Updated region data
- Updated service data
- Updated go.mod/go.sum if needed
Generated on: $current_date
EOF
git commit -F commit_message.txt
rm commit_message.txt
echo "changed=true" >> $GITHUB_OUTPUT
echo "📊 Changes detected in AWS data, committing updates"
fi
- name: Push changes if any
if: steps.git-diff.outputs.changed == 'true'
run: |
git push origin main
echo "✅ AWS data updates pushed to main branch"
- name: Log completion
run: |
if [ "${{ steps.git-diff.outputs.changed }}" == "true" ]; then
echo "🎉 Nightly data update completed successfully"
echo "📈 Latest AWS service, region, and partition data is now available"
echo "🔄 Weekly release workflow will create the next version tag"
else
echo "✨ No updates needed - AWS data is current"
fi