Skip to content

Commit

Permalink
WIP: Setup Automation
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Jan 10, 2025
1 parent 1ed3b1b commit 8088971
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
applies-to: "version-updates"
patterns:
- "*"
- package-ecosystem: "mix"
directory: "/"
schedule:
interval: "weekly"
groups:
mix:
applies-to: "version-updates"
patterns:
- "*"
80 changes: 80 additions & 0 deletions .github/workflows/calculate_dataset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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/*

0 comments on commit 8088971

Please sign in to comment.