-
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (28 loc) · 1.11 KB
/
update-metadata.yml
File metadata and controls
32 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Update Metadata Files
on:
workflow_dispatch:
push:
paths:
- 'README.md'
jobs:
update-metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update metadata files
run: |
REPO_NAME="${GITHUB_REPOSITORY#*/}"
REPO_DESC=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/$GITHUB_REPOSITORY | jq -r .description)
# Update .zenodo.json
if [ -f .zenodo.json ]; then
jq --arg title "$REPO_NAME" '.title = $title' .zenodo.json > .zenodo.json.tmp
jq --arg desc "$REPO_DESC" '.description = $desc' .zenodo.json.tmp > .zenodo.json
fi
# Similar approach for CITATION.cff
# [Additional code to update CITATION.cff]
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add .zenodo.json CITATION.cff
git commit -m "Update metadata with repository info" || echo "No changes to commit"
git push