Skip to content

Commit

Permalink
Have cron job create PR to update notebook outputs (Qiskit#1543)
Browse files Browse the repository at this point in the history
Each time the fortnightly cron job runs, I usually make a PR updating
the notebooks in this repo with the output of the cron job. This PR
automates that process. As well as saving some manual work, this also
means I can review those PRs too.

See #10 for an example
of this working.
  • Loading branch information
frankharkins authored Jun 13, 2024
1 parent 52552f4 commit 1981667
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/notebook-test-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ jobs:
git diff --name-only >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Make pull request with notebook outputs
if: "!cancelled()"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git switch -c actions/cron-${{ github.run_id }}
git commit -am "Re-run notebooks"
git push origin actions/cron-${{ github.run_id }}
gh pr create \
-B main \
-H actions/cron-${{ github.run_id }} \
--title "Update notebook outputs" \
--body "An action recently executed the notebooks in this repo. \
This PR updates all notebooks that ran successfully with the new cell outputs.
> [!NOTE]
> This pull request was created by a GitHub action." \
--reviewer frankharkins
- name: Upload executed notebooks
if: "!cancelled()"
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 1981667

Please sign in to comment.