File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Test GPG Key Expiry
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : ' 30 3 * * *'
7+
8+ jobs :
9+ key-expiry :
10+ name : Test GPG Key Expiry
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Import GPG key
14+ uses : crazy-max/ghaction-import-gpg@v6
15+ with :
16+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
17+ passphrase : ${{ secrets.GPG_PASSPHRASE }}
18+ - name : Test GPG key expiry
19+ run : |
20+ EXPIRY=$(gpg --list-keys | egrep -o "expires:\s+[0-9-]+" | egrep -o "[0-9-]+" | sort | head -n 1)
21+ echo "GPG key expires on ${EXPIRY}"
22+ DELTA=$(( $(date --date "${EXPIRY}" '+%s') - $(date '+%s') ))
23+ echo "GPG key expires in ${DELTA} seconds"
24+ [[ ${DELTA} -ge 2592000 ]] && echo "GPG key valid for at least another 30 days" || echo "GPG key will expire within the next 30 days"
25+ [[ ${DELTA} -ge 2592000 ]]
Original file line number Diff line number Diff line change 2323 with :
2424 gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
2525 passphrase : ${{ secrets.GPG_PASSPHRASE }}
26+ - name : Test GPG key expiry
27+ run : |
28+ EXPIRY=$(gpg --list-keys | egrep -o "expires:\s+[0-9-]+" | egrep -o "[0-9-]+" | sort | head -n 1)
29+ echo "GPG key expires on ${EXPIRY}"
30+ DELTA=$(( $(date --date "${EXPIRY}" '+%s') - $(date '+%s') ))
31+ echo "GPG key expires in ${DELTA} seconds"
32+ [[ ${DELTA} -ge 0 ]]
2633 - name : Set up JDK/Maven
2734 uses : actions/setup-java@v4
2835 with :
You can’t perform that action at this time.
0 commit comments