Skip to content

Commit

Permalink
Eliminating parts that Gill don't like
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadav Ben Ami authored and Nadav Ben Ami committed Oct 22, 2024
1 parent 33e011b commit f55863d
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/test-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Print repository name
run: |
echo "Repository Name: ${{ github.repository }}"
# Check out the branch from the pull request, whether it's from a fork or not
- name: Checkout the target branch # logic step
run: |
Expand All @@ -46,7 +42,8 @@ jobs:
git status
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
echo "We're in pull_request_target"
target_branch="${{ github.event.pull_request.base.ref }}" # from old config
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV
target_branch="${{ github.event.pull_request.base.ref }}"
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
echo "PR from a fork detected. Checking out the fork's branch."
# Checking out the fork's branch while still being in Classiq/classiq-library repo
Expand All @@ -62,19 +59,20 @@ jobs:
# `actions/checkout` will checkout to the branch that you chose in the `dispatch` tab - so we do nothing
echo "we're in the right branch. no need to checkout (dispatch)"
target_branch="${{ github.ref_name }}" # from old config
echo $target_branch # from old config
echo $target_branch
echo "SHOULD_TEST_ALL_FILES=true" >> $GITHUB_ENV
echo "list_of_ipynb_changed=**/*.ipynb" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "push" ]]; then
# we believe that `actions/checkout` will checkout to the branch that we push into (i.e. either `dev` or `main`)
echo "we're in the right branch. no need to checkout (push)"
target_branch="$(gh pr view --json baseRefName,headRefName --jq .baseRefName)" # from old config
target_branch="$(gh pr view --json baseRefName,headRefName --jq .baseRefName)"
else
echo "we're not in push/pull/dispatch. error."
exit 1
fi
# debug
echo "==== after"
git status
echo "Repository Name: ${{ github.repository }}" # Debug - intresting when PR is from a fork
- name: Set up Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -120,17 +118,6 @@ jobs:
run: |
echo "Changed notebook files: ${{ steps.changed-files-ipynb.outputs.all_changed_files }}"
- name: Set changed notebook into environment variables # Could be integrated in logic step
run: |
set -ex
if [ "${{ github.event_name }}" == 'pull_request_target' ]; then
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV
echo "list_of_ipynb_changed=${{ steps.changed-files-ipynb.outputs.all_changed_files }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then
echo "SHOULD_TEST_ALL_FILES=true" >> $GITHUB_ENV
echo "list_of_ipynb_changed=**/*.ipynb" >> $GITHUB_ENV
fi
- name: Install dependencies
run: |
set -e
Expand Down

0 comments on commit f55863d

Please sign in to comment.