Skip to content

Change standard gates examples to have main outputs #333

Change standard gates examples to have main outputs

Change standard gates examples to have main outputs #333

name: "Detect New Notebooks in PR"
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
- update_labeler
jobs:
detect-and-respond:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check for newly added notebooks
id: check-new-notebooks
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const files = await github.paginate(
github.rest.pulls.listFiles,
{ owner, repo, pull_number: prNumber }
);
const newNotebooks = files.filter(file =>
file.filename.endsWith(".ipynb") && file.status === "added"
);
console.log(`setting notebook_count to ${newNotebooks.length}`);
core.setOutput("notebook_count", newNotebooks.length);
core.setOutput("notebook_filenames", newNotebooks.map(f => f.filename).join("\n"));
core.setOutput("notebook_files", newNotebooks.join("\n"));
- name: Add 'new notebook' label
if: ${{ steps.check-new-notebooks.outputs.notebook_count != '0' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: new notebook
- name: Comment on PR
if: ${{ steps.check-new-notebooks.outputs.notebook_count != '0' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
header: new-notebook-alert
message: |
🔥 New notebook just dropped!
@amir-naveh , @TomerGoldfriend — come check out this shiny new addition to our repo.