Skip to content

Commit

Permalink
Merge pull request #102 from AnonymousCodes911/fix_g_actions
Browse files Browse the repository at this point in the history
Fix Github Actions
  • Loading branch information
matteobachetti authored Apr 22, 2024
2 parents ba9b322 + 1802f49 commit a5f8221
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions .github/workflows/build_test_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,41 @@ jobs:
path: ./stingray
submodules: recursive

- name: Get latest commit of the PR and Checkout PR version of notebooks
# This step gets the latest commit of the PR or the pushed commit and checks out the PR version of the notebooks
- name: Get latest commit of the PR or pushed commit and Checkout PR version of Notebooks
run: |
PR_SHA=$(curl -s 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}' | jq -r .head.sha)
if [ "$PR_SHA" == "null" ]; then
echo "::error::Failed to get PR SHA"
exit 1
# If the event is a pull request, fetch the PR SHA
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "PR event detected. Fetching PR SHA..."
PR_SHA=$(curl -s 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}' | jq -r .head.sha)
if [ "$PR_SHA" == "null" ]; then
echo "::error::Failed to get PR SHA"
exit 1
fi
echo "commit=$PR_SHA" >> $GITHUB_ENV
cd ./stingray/docs/notebooks # Change to the submodule directory
git fetch origin $PR_SHA:pr_temp
git checkout pr_temp
# If the event is a push, use the pushed commit SHA
else
echo "Push event detected. Using pushed commit SHA..."
echo "commit=${{ github.sha }}" >> $GITHUB_ENV
cd ./stingray/docs/notebooks # Change to the submodule directory
pwd
git fetch origin ${{ github.sha }}:pr_temp
git checkout pr_temp
fi
echo "commit=$PR_SHA" >> $GITHUB_ENV
cd ./stingray/docs/notebooks # Change to the submodule directory
pwd
git fetch origin $PR_SHA:pr_temp
git checkout pr_temp
# This step verifies that the submodule has been updated
- name: Verify submodule update
run: |
cd ./stingray/docs/notebooks
git log -1
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand All @@ -51,6 +70,7 @@ jobs:
- name: Install Stingray
run: |
pip install -e ./stingray
- name: Run Build Docs
run: |
cd ./stingray
Expand Down

0 comments on commit a5f8221

Please sign in to comment.