-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (41 loc) · 1.63 KB
/
manual.yml
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
# This is a basic workflow that is manually triggered
name: getcrl
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
description: 'get moica crl'
schedule:
- cron: '0 12,0 * * *'
jobs:
run_tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run script file
run: |
sourcefile='.github/source.json'
array_length=$(jq '. | length' ${sourcefile})
echo ${array_length}
for ((i = 0; i < ${array_length}; i++)); do
crlfile=$(cat ${sourcefile} | jq ".[$i].url" | sed 's/"//g')
wget $crlfile -O complete.crl
filename=$(cat ${sourcefile} | jq ".[$i].file" | sed 's/"//g')
echo $?
openssl crl -nameopt utf8 -inform DER -text -in complete.crl | grep "Serial Number" | awk '{print $3}' > temp
awk -v RS= '/----/{next}{gsub(/\n/,"\",\"")}BEGIN{printf "\""}7' temp > temp2
SN="$(cat temp2)\""
version=$(openssl crl -nameopt utf8 -inform DER -text -in complete.crl | awk '/X509v3 CRL Number:/ {getline; gsub(/^[ \(/^[ \t]+|[ \t]+$/, ""); print}')
printf "{\"version\":\"$version\", \"value\":[$SN]}" > temp3
cat temp3 | jq > ${filename}
rm temp temp2 temp3 complete.crl
done
date '+%Y-%m-%d %H:%M.%S' > .github/last_executed.txt
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add . && git commit -m "update" && git push -f
shell: bash