oct 2024 monthly ntd ridership publish #1387
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate nbviewer links | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
paths: | |
- "**.ipynb" | |
jobs: | |
nbviewer-links: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: get files | |
id: files | |
uses: jitterbit/get-changed-files@v1 | |
continue-on-error: true | |
- name: add comments | |
uses: actions/github-script@v3 | |
env: | |
FILES: ${{steps.files.outputs.all}} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const body = process.env.FILES | |
.split(" ") | |
.filter(f => (f.endsWith(".ipynb") && !f.startsWith("portfolio/"))) | |
.map(f => `* [${f}](https://nbviewer.jupyter.org/github/${context.repo.owner}/${context.repo.repo}/blob/${context.sha}/${f})`) | |
if (body.length > 0) { | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "nbviewer URLs for impacted notebooks:\n\n" + body.join("\n") | |
}) | |
} |