Skip to content

Daily Data Fetch

Daily Data Fetch #2675

Workflow file for this run

name: Daily Data Fetch
on:
schedule:
# This will run at 00:00, 08:00, and 16:00 UTC
- cron: "0 0,8,16 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
data-fetch:
name: Collect Data from Jira
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
token: ${{ secrets.GHTOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Set short SHA
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Get current time
run: echo "CURRENT_TIME=$(date +'%H%M%S')" >> $GITHUB_ENV
- name: Build Container Image
id: build_container
uses: docker/build-push-action@v7
with:
load: true
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: riscvintl/bod-jira-data-image:latest
- name: Run Container
id: run_container
if: steps.build_container.outcome == 'success'
run: docker run --rm -e JIRA_TOKEN=${{ secrets.JIRATOKEN }} -e JIRA_EMAIL=${{ secrets.JIRA_EMAIL }} -e GHTOKEN=${{ secrets.GHTOKEN }} -v ./:/usr/src/app/ riscvintl/bod-jira-data-image:latest
- name: Upload Data
if: steps.run_container.outcome == 'success'
uses: actions/upload-artifact@v7
with:
name: spec-data.csv
path: ${{ github.workspace }}/*.csv
- name: Create Release
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
uses: softprops/action-gh-release@v3 #softprops/action-gh-release@v2
with:
draft: false
tag_name: bod-jira-data-${{ env.SHORT_SHA }}-${{ env.CURRENT_DATE }}-${{ env.CURRENT_TIME }}
name: ${{ env.CURRENT_TIME }}
body: |
This release was created by: ${{ github.event.sender.login }}
Release Notes: ${{ github.event.inputs.release_notes }}
files: |
${{ github.workspace }}/*.csv
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
- name: Update latest CSV for UI
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
run: |
set -euo pipefail
latest_csv=$(ls -t specs_*.csv | head -n1 || true)
if [ -z "$latest_csv" ]; then
echo "No specs_*.csv found."
exit 1
fi
mkdir -p web-ui/public
cp "$latest_csv" web-ui/public/latest.csv
printf "updated_at=%s\nrun_id=%s\n" \
"$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
"${GITHUB_RUN_ID}" \
> web-ui/public/latest.csv.meta
- name: Commit latest CSV
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add web-ui/public/latest.csv web-ui/public/latest.csv.meta
git commit -m "Update latest CSV" --allow-empty
git push origin HEAD:main