Skip to content

Update package components #93

Update package components

Update package components #93

name: Update package components
on:
push:
paths:
- 'additional_info.toml'
- '.github/workflows/update-package-components.yml'
- 'scripts/update_package_components.jl'
workflow_dispatch:
schedule:
# Run at 3 AM UTC every day
- cron: '0 3 * * *'
permissions:
contents: write
jobs:
update-package-components:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref || github.ref_name }}
- name: Set up git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup Julia
uses: julia-actions/setup-julia@v1
- name: Install Julia dependencies
run: |
julia --project=. -e 'using Pkg; Pkg.instantiate()'
- name: Update package components
id: update
run: |
julia --project=. scripts/update_package_components.jl
- name: Commit changes (if any)
id: git_commit
run: |
git add package_components.toml
if git diff --cached --quiet; then
echo "No changes to commit."
echo "committed=false" >> $GITHUB_OUTPUT
else
git commit -m "[automatic] update package components"
echo "committed=true" >> $GITHUB_OUTPUT
fi
- name: Push directly to branch or main
if: |
steps.git_commit.outputs.committed == 'true'
run: |
# For PRs, push to the PR's branch; for main, push to main
current_branch="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
git push origin HEAD:"$current_branch"