-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (32 loc) · 1.27 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
# 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: |
wget https://moica.nat.gov.tw/repository/MOICA/CRL2/complete.crl
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]}" > moica2-crl.json
date '+%Y-%m-%d %H:%M.%S' > .github/last_executed.txt
rm temp temp2 complete.crl
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