WIP: Setup Automation #2
Workflow file for this run
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
on: | |
schedule: | |
# Once a month at 15:27 (random time to not congest GitHub exactly at midnight) | |
- cron: "27 15 1 * *" | |
workflow_dispatch: | |
inputs: | |
dataset_name: | |
type: string | |
required: false | |
# TODO: Remove | |
push: | |
branches: | |
- 'ci' | |
jobs: | |
define_name: | |
runs-on: ubuntu-latest | |
outputs: | |
dataset_name: "${{ inputs.dataset_name || steps.current-date.outputs.DATASET_NAME }}" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: "Get Current Date" | |
id: current-date | |
run: 'echo "DATASET_NAME=$(date --iso-8601)" >> $GITHUB_OUTPUT' | |
fetch_projects: | |
runs-on: ubuntu-latest | |
needs: ["define_name"] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: "Checkout Code" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: "Setup BEAM" | |
uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2 | |
id: setupBEAM | |
with: | |
version-file: .tool-versions | |
version-type: strict | |
- name: "Cache Deps & Build" | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
_build | |
deps | |
key: mix-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ hashFiles('mix.exs') }} | |
restore-keys: | | |
mix-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ steps.setupBEAM.outputs.elixir-version }}- | |
- name: "Get Mix Dependencies" | |
run: mix deps.get | |
- name: "Compile Project" | |
run: mix compile | |
- name: "Fetch Hex.pm Projects" | |
run: mix openssf_compliance.fetch_projects "$DATASET_NAME" | |
env: | |
DATASET_NAME: "${{ needs.define_name.outputs.dataset_name }}" | |
HEX_API_KEY: "${{ secrets.HEX_API_KEY }}" | |
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: projects | |
path: priv/data/projects/* |