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

Support reporting to a PR from another repository #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Available settings:
| ------------------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| gh_access_token | | Token to access GH API. In most cases you can use GITHUB_TOKEN that is available in the workflow |
| report_path | 'reports' | Path to reports from the download artifact action |
| repository | ${{ github.repository }} | Repository containing the commit or pull request that triggered the tests |
| sha | ${{ github.sha }} | SHA of the commit that triggered the tests |
| pull_request_id | ${{ github.event.number }} | ID of the pull request that triggered pipeline |
| summary | 'true' | Add report to job summary |
Expand Down
15 changes: 12 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ inputs:
required: true
default: 'reports'
sha:
description: 'SHA of the commit tha triggered the tests'
description: 'SHA of the commit that triggered the tests'
required: false
default: "${{ github.sha }}"
repository:
description: 'Repository of the commit or pull request that triggered the tests'
required: false
default: "${{ github.repository }}"
pull_request_id:
description: 'ID of the Pull Request'
required: false
Expand All @@ -34,8 +38,13 @@ runs:
steps:
- shell: bash
run: |
export OWNER="$(echo "${{ github.repository }}" | awk -F / '{print $1}' | sed -e "s/:refs//")"
export REPO="$(echo "${{ github.repository }}" | awk -F / '{print $2}' | sed -e "s/:refs//")"
if [[ "${{ inputs.repository }}" =~ "/" ]]; then
export OWNER="$(echo "${{ inputs.repository }}" | awk -F / '{print $1}' | sed -e "s/:refs//")"
export REPO="$(echo "${{ inputs.repository }}" | awk -F / '{print $2}' | sed -e "s/:refs//")"
else
export OWNER="$(echo "${{ github.repository }}" | awk -F / '{print $1}' | sed -e "s/:refs//")"
export REPO="$(echo "${{ inputs.repository }}" | sed -e "s/:refs//")"
fi
echo "REPOSITORY_OWNER=$OWNER" >> $GITHUB_ENV
echo "REPOSITORY_NAME=$REPO" >> $GITHUB_ENV
- shell: bash
Expand Down