Skip to content

DataHub Security Advisory Alert #10

DataHub Security Advisory Alert

DataHub Security Advisory Alert #10

Workflow file for this run

name: DataHub Security Advisory Alert
on:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight
workflow_dispatch:
jobs:
check-security-advisories:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch security advisories
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -H "Accept: application/vnd.github+json" /repos/datahub-project/datahub/security-advisories > advisories.json
- name: Get last run date for this Action
id: get_last_run_date
env:
GH_TOKEN: ${{ github.token }}
run: |
LAST_RUN_DATE=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/ministryofjustice/data-catalogue/actions/runs \
--jq '.workflow_runs[]
| select(.conclusion=="success" and .status=="completed" and .path=={{ github.action_path }})
| .run_started_at' \
| head -n 1)
echo "last_run_date=${LAST_RUN_DATE}" >> "${GITHUB_OUTPUT}"
- name: Read current version from values.yaml
id: read_current_version
run: |
CURRENT_VERSION=$(python -c "import yaml; print(yaml.safe_load(open('helm_deploy/values-base.yaml'))['global']['datahub']['version'])")
echo "current_version=${CURRENT_VERSION}" >> "${GITHUB_OUTPUT}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install semantic-version
- name: Filter advisories
id: filter_advisories
run: python scripts/filter_advisories.py \
"${{ steps.read_current_version.outputs.current_version }}" \
"${{ steps.get_last_run_date.outputs.last_run_date }}"
- name: Send advisories to Slack
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C071VNHPUHZ'
payload-file-path: "./filtered_advisories.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.VULN_CHECK_SLACK_BOT_TOKEN }}