Skip to content

getcrl

getcrl #23

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: |
sudo apt install -y jq
sourcefile='.github/source.json'
array_length=$(jq '. | length' $sourcefile)
for ((i = 0; i < $array_length; i++)); do
crlfile=$(cat $sourcefile | jq ".[$i].url" | sed 's/"//g')
wget $crlfile
filename=$(cat $sourcefile | jq ".[$i].file" | sed 's/"//g')
openssl crl -nameopt utf8 -inform DER -text -in complete.crl | grep "Serial Number" | cut -d " " -f 7 > 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]}" > $filename
rm temp temp2 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