Skip to content

Commit deaee37

Browse files
committed
Update workflow to create PR instead of pushing to develop directly #57
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent ab20b92 commit deaee37

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

.github/workflows/update-citation.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
max-parallel: 4
1313
matrix:
14-
python-version: [3.13]
14+
python-version: [3.13]
1515

1616
steps:
1717
- name: Checkout code
@@ -20,27 +20,38 @@ jobs:
2020
- name: Set up Python ${{ matrix.python-version }}
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: ${{ matrix.python-version }}
23+
python-version: ${{ matrix.python-version }}
2424

2525
- name: Install doi2cff
2626
run:
27-
pip install
28-
git+https://github.com/citation-file-format/doi2cff
27+
pip install
28+
git+https://github.com/citation-file-format/doi2cff
2929

3030
- name: Fetch latest Zenodo DOI
31+
id: get-doi # Assign an ID to this step to reference its outputs
3132
env:
32-
ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }}
33+
ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }}
3334
run: |
34-
python etc/scripts/fetch_latest_doi.py > latest_doi.txt
35-
echo "Latest DOI: $(cat latest_doi.txt)"
35+
ZENODO_DOI=$(python etc/scripts/fetch_latest_doi.py)
36+
echo "ZENODO_DOI=${ZENODO_DOI}" >> "$GITHUB_OUTPUT"
3637
3738
- name: Update CITATION.cff
38-
run: doi2cff update $(cat latest_doi.txt)
39+
# Use the output from the 'get-doi' step as the argument for doi2cff
40+
run: doi2cff update ${{ steps.get-doi.outputs.ZENODO_DOI }}
3941

40-
- name: Commit updated CITATION.cff
41-
run: |
42-
git config user.name "github-actions"
43-
git config user.email "[email protected]"
44-
git add CITATION.cff
45-
git commit -m "Update CITATION.cff with latest Zenodo DOI"
46-
git push origin HEAD:develop
42+
- name: Create Pull Request
43+
uses: peter-evans/create-pull-request@v6
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
base: develop
47+
branch: update-citation-${{ github.event.release.tag_name }}
48+
commit-message:
49+
'Automated: Update CITATION.cff with the latest Zenodo DOI'
50+
title: 'Automated: Update CITATION.cff'
51+
body: |
52+
This is an automated pull request to update the `CITATION.cff` file
53+
with the latest Zenodo DOI fetched from Zenodo repository.
54+
# Set to true to automatically merge the PR if all checks pass (optional)
55+
# automerge: true
56+
# Set to true to delete the branch after merging (optional)
57+
# delete-branch: true

0 commit comments

Comments
 (0)