|
| 1 | +name: Generate news posts from ADS library |
| 2 | + |
| 3 | +on: |
| 4 | + # Run every Monday at 08:00 UTC |
| 5 | + schedule: |
| 6 | + - cron: "0 8 * * 1" |
| 7 | + # Allow manual runs from the GitHub Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# Prevent simultaneous runs to avoid compounding ADS rate-limit pressure. |
| 11 | +# A newly triggered run will wait for any already-running instance to finish. |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }} |
| 14 | + cancel-in-progress: false |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + pull-requests: write |
| 19 | + |
| 20 | +jobs: |
| 21 | + ads-news-posts: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Check out repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Set up Python |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: "3.12" |
| 32 | + |
| 33 | + - name: Install Python dependencies |
| 34 | + run: pip install -r scripts/requirements.txt |
| 35 | + |
| 36 | + - name: Generate draft posts from ADS library |
| 37 | + env: |
| 38 | + ADS_TOKEN: ${{ secrets.ADS_TOKEN }} |
| 39 | + run: python scripts/ads_to_posts.py --posts-dir _posts |
| 40 | + |
| 41 | + - name: Check for new posts |
| 42 | + id: check |
| 43 | + run: | |
| 44 | + git add _posts/ |
| 45 | + if git diff --cached --quiet; then |
| 46 | + echo "new_posts=false" >> "$GITHUB_OUTPUT" |
| 47 | + else |
| 48 | + echo "new_posts=true" >> "$GITHUB_OUTPUT" |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: Create pull request with new post drafts |
| 52 | + if: steps.check.outputs.new_posts == 'true' |
| 53 | + uses: peter-evans/create-pull-request@v7 |
| 54 | + with: |
| 55 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + branch: ads-news-drafts/${{ github.run_id }} |
| 57 | + base: main |
| 58 | + commit-message: "news: add draft publication posts from ADS library" |
| 59 | + title: "News post drafts from ADS library (${{ github.run_id }})" |
| 60 | + body: | |
| 61 | + This pull request was opened automatically by the **Generate news posts from ADS library** workflow. |
| 62 | +
|
| 63 | + It contains draft Markdown files in `_posts/` for publications found in the [PFITS+ ADS library](https://ui.adsabs.harvard.edu/public-libraries/_-AhcKuYSKyaIu_U5ebVsA) that do not yet have a corresponding news post. |
| 64 | +
|
| 65 | + **Before merging, please review each file and:** |
| 66 | + - Trim the `tags:` list to 3–6 relevant subject keywords (remove overly specific or administrative ones). |
| 67 | + - Verify that all team-member authors have working profile links. |
| 68 | + - Confirm the citation line (journal, volume, and page numbers). |
| 69 | + - For arXiv preprints, update the entry once the paper is formally published. |
| 70 | +
|
| 71 | + See `_posts/README.md` for full formatting conventions. |
| 72 | + labels: "news,publications,automated" |
| 73 | + draft: false |
0 commit comments