Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update router job to bring the ability to run main workflow outside PR back #198

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,26 @@ jobs:
- run: git config --global --add safe.directory .
- run: git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
- run: git fetch origin main
- name: Extract base commit
run: |
result="${{ github.event.pull_request.base.sha }}"
if [ -z "$result" ]; then
result=$(git rev-parse origin/main)
fi
echo "result=$result" >> $GITHUB_OUTPUT
id: extract_base_commit
- name: Extract head commit
run: |
result="${{ github.event.pull_request.head.sha }}"
if [ -z "$result" ]; then
result=$(git rev-parse HEAD)
fi
echo "result=$result" >> $GITHUB_OUTPUT
id: extract_head_commit
- name: Get packages affected by changes in the current commit
id: get_affected
run: |
TARGET_DATA=$(. /venv/bin/activate && dl-git range-diff-paths --only-added-commits --base ${{ github.event.pull_request.base.sha }} --head ${{ github.event.pull_request.head.sha }})
TARGET_DATA=$(. /venv/bin/activate && dl-git range-diff-paths --only-added-commits --base ${{ steps.extract_base_commit.outputs.result }} --head ${{ steps.extract_head_commit.outputs.result }})
echo "$TARGET_DATA" > /tmp/targets.json
cat /tmp/targets.json
. /venv/bin/activate && detect-affected-packages \
Expand Down
Loading