Change standard gates examples to have main outputs #333
Workflow file for this run
This file contains hidden or 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: "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. |