11# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
22name : Import Publications From Bibtex
33
4- # Require permission to create a PR
4+ # Require permission to create a PR (least privilege principle)
55permissions :
66 contents : write
77 pull-requests : write
8+ metadata : read
89
910# Run workflow when a `.bib` file is added or updated in the `data/` folder
1011on :
@@ -19,39 +20,81 @@ jobs:
1920 hugoblox :
2021 if : github.repository_owner != 'HugoBlox'
2122 runs-on : ubuntu-latest
23+ timeout-minutes : 10
24+
25+ env :
26+ ACADEMIC_VERSION : ' >=0.10.0'
2227 steps :
2328 - name : Checkout the repo
24- uses : actions/checkout@v3
25- - name : Set up Python 3.12
26- uses : actions/setup-python@v4
29+ uses : actions/checkout@v4
30+ with :
31+ # Fetch history for better performance and debugging
32+ fetch-depth : 0
33+
34+ - name : Set up Python 3.13
35+ uses : actions/setup-python@v5
2736 with :
28- python-version : " 3.12"
37+ python-version : ' 3.13'
38+ - name : Setup pip cache
39+ uses : actions/cache@v4
40+ with :
41+ path : ~/.cache/pip
42+ key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
43+ restore-keys : |
44+ ${{ runner.os }}-pip-
45+
2946 - name : Install dependencies
3047 run : |
3148 python -m pip install --upgrade pip
32- pip install academic==0.10.0
49+ pip install academic${{ env.ACADEMIC_VERSION }}
3350 - name : Run Academic (Bibtex To Markdown Converter)
3451 # Check `.bib` file exists for case when action runs on `.bib` deletion
3552 # Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
3653 if : ${{ hashFiles('publications.bib') != '' }}
37- run : academic import publications.bib content/publication/ --compact
54+ run : |
55+ echo "Starting publication import..."
56+ academic import publications.bib content/publication/ --compact
57+ echo "Publication import completed successfully"
58+ continue-on-error : false
3859 - name : Create Pull Request
3960 # Set ID for `Check outputs` stage
4061 id : cpr
41- uses : peter-evans/create-pull-request@v5
62+ uses : peter-evans/create-pull-request@v6
4263 with :
43- commit-message : ' content: import publications from Bibtex'
44- title : Hugo Blox Builder - Import latest publications
64+ commit-message : ' content(publications): run Hugo Blox importer to import publications from Bibtex'
65+ title : ' Hugo Blox Builder - Import latest publications from Bibtex '
4566 body : |
46- Import the latest publications from `publications.bib` to `content/publication/`.
67+ 🔄 **Automated Publication Import**
68+
69+ This PR automatically imports the latest publications from `publications.bib` to `content/publication/`.
70+
71+ **Changes:**
72+ - 📚 Updated publication entries
73+ - 🏷️ Processed bibliographic data
74+
75+ ---
4776 将最新的出版物从`publications.bib`导入到`content/publication/`。
48- [View Documentation](https://github.com/GetRD/academic-file-converter)
77+
78+ 📖 [View Documentation](https://github.com/GetRD/academic-file-converter)
4979 base : main
50- labels : automated-pr, content
80+ labels : automated-pr, content, publications
5181 branch : hugoblox-import-publications
5282 delete-branch : true
83+ draft : false
5384 - name : Check outputs
5485 if : ${{ steps.cpr.outputs.pull-request-number }}
5586 run : |
56- echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
57- echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
87+ echo "✅ Successfully created Pull Request!"
88+ echo "📝 Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
89+ echo "🔗 Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
90+ echo "🎯 Operation completed at $(date)"
91+
92+ - name : Report workflow status
93+ if : always()
94+ run : |
95+ if [ "${{ job.status }}" == "success" ]; then
96+ echo "🎉 Workflow completed successfully"
97+ else
98+ echo "❌ Workflow failed - check logs for details"
99+ exit 1
100+ fi
0 commit comments