File tree 2 files changed +47
-6
lines changed
2 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 1
- name : . 🔍🔍 Show the latest added files into the S3 repository
1
+ name : . 🔍🔍 Show N files added before and after datetime into the S3 repository
2
2
3
3
on :
4
4
workflow_dispatch :
5
5
inputs :
6
6
count :
7
- description : ' Show the latest N packages'
7
+ description : ' Amount of files to show'
8
+ type : string
9
+ default : ' 500'
10
+ required : true
11
+ date_time :
12
+ description : ' Date and time to show files added before and after (YYYY-MM-DD HH:MM:SS)'
8
13
type : string
9
- default : ' 1000'
10
14
required : true
11
15
12
16
jobs :
13
- scan-deps :
17
+ list-files :
14
18
name : List latest added packages into the S3 repository
15
19
runs-on : ubuntu-20.04
16
20
steps :
17
- - name : List latest packages in S3
21
+ - name : Validate datetime
22
+ run : |
23
+ datetime="${{ github.event.inputs.date_time }}"
24
+ # Regular expression to match the format YYYY-MM-DD HH:MM:SS
25
+ regex="^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$"
26
+
27
+ if [[ $datetime =~ $regex ]]; then
28
+ # Use date command to check if it's a valid date
29
+ date -d "$datetime" >/dev/null 2>&1 || exit 1
30
+ else
31
+ exit 1
32
+ fi
33
+
34
+ - name : List files created before and after datetime in S3
18
35
run : |
19
- TZ="UTC" aws s3 ls s3://nr-downloads-main/infrastructure_agent/ --recursive | sort | grep -E "\.(rpm|deb)$" | tail -n $ {{ github.event.inputs.count }}
36
+ TZ="UTC" aws s3 ls s3://nr-downloads-main/infrastructure_agent/ --recursive | sort | grep --color -m 1 -C {{ github.event.inputs.count }} "^${{ github.event.inputs.date_time }}"
20
37
env :
21
38
AWS_ACCESS_KEY_ID : ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_PRODUCTION }}
22
39
AWS_SECRET_ACCESS_KEY : ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
Original file line number Diff line number Diff line change
1
+ name : . 🔍🔍 Show the latest added files into the S3 repository
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ count :
7
+ description : ' Show the latest N packages'
8
+ type : string
9
+ default : ' 1000'
10
+ required : true
11
+
12
+ jobs :
13
+ list-packages :
14
+ name : List latest added packages into the S3 repository
15
+ runs-on : ubuntu-20.04
16
+ steps :
17
+ - name : List latest packages in S3
18
+ run : |
19
+ TZ="UTC" aws s3 ls s3://nr-downloads-main/infrastructure_agent/ --recursive | sort | grep -E "\.(rpm|deb)$" | tail -n ${{ github.event.inputs.count }}
20
+ env :
21
+ AWS_ACCESS_KEY_ID : ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_PRODUCTION }}
22
+ AWS_SECRET_ACCESS_KEY : ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
23
+ AWS_ROLE_ARN : ${{ secrets.OHAI_AWS_ROLE_ARN_PRODUCTION }}
24
+ AWS_ROLE_SESSION_NAME : ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_PRODUCTION }}
You can’t perform that action at this time.
0 commit comments