Skip to content

getcrl

getcrl #598

Workflow file for this run

# 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')
openssl crl -nameopt utf8 -inform DER -text -in complete.crl | awk '/Serial Number/ {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