Skip to content

Commit

Permalink
Re-add fork behaviour
Browse files Browse the repository at this point in the history
We shouldn't have this in nb-tester since it's specific to our repo. It's short enough to inline in our action.
  • Loading branch information
frankharkins committed Nov 29, 2024
1 parent 8e28dff commit 1e3f3dc
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/notebook-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,24 @@ jobs:
args = ["tox", "--", "--write"]
if changed_notebooks and not changed_config:
args.extend(changed_notebooks.split("\n"))
if os.environ["PR_REPOSITORY"] != os.environ["GITHUB_REPOSITORY"]:
args.append("--is-fork")
subprocess.run(args, check=True)
try:
subprocess.run(args, check=True)
except Exception as err:
if os.environ["PR_REPOSITORY"] != os.environ["GITHUB_REPOSITORY"]:
raise SystemExit(
"We can't run this test on pull requests from forks."
"\n\n"
"If you have write access to Qiskit/documentation, push to a new "
"branch there and make your pull request from that branch instead."
"\n\n"
"If you don't have write access, you must test out the notebook "
"locally using the instructions in "
"https://github.com/Qiskit/documentation#execute-notebooks."
"When this PR is approved, a maintainer will merge it to a new "
"branch in Qiskit/documentation, then make a PR from that branch "
"into main so it can pass CI."
) from err
raise err
- name: Detect changed notebooks
id: changed-notebooks
Expand Down

0 comments on commit 1e3f3dc

Please sign in to comment.