CVE Freshness Check #591
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CVE Freshness Check | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '15,45 * * * *' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
pull_latest_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get latest release | |
id: get_latest_release | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/${{ github.repository }}/releases/latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check release time | |
id: check_release_time | |
run: | | |
current_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
release_time=$(echo '${{ fromJson(steps.get_latest_release.outputs.data).published_at }}') | |
echo "Current time: $current_time" | |
echo "Release time: $release_time" | |
current_time_epoch=$(date -d "$current_time" +%s) | |
release_time_epoch=$(date -d "$release_time" +%s) | |
time_diff=$((current_time_epoch - release_time_epoch)) | |
echo "Time difference: $time_diff seconds" | |
echo "::set-output name=time_diff::$time_diff" | |
- name: Send Slack message if release > 3600 seconds | |
if: steps.check_release_time.outputs.time_diff > 3600 | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"text": "failure\n${{ github.event.pull_request.html_url || github.event.head.html_url }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "<!subteam^S086VL144TU>, security artifacts generation result: failure\nhttps://github.com/fleetdm/vulnerabilities/actions/runs/${{ github.run_id }}\nSee https://github.com/fleetdm/vulnerabilities/actions?query=is%3Afailure for failure details\n${{ github.event.pull_request.html_url || github.event.head.html_url }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_P1_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |