diff --git a/README.md b/README.md index b00ae2d..fcb22f3 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/action.yml b/action.yml index 19caddc..2238af0 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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