Add custom source sha (#126)
Co-authored-by: Tonye Jack <jtonye@ymail.com>
This commit is contained in:
parent
b4b0cdd1b5
commit
53afe7a5b5
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@ -130,3 +130,13 @@ jobs:
|
||||
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with custom sha
|
||||
id: changed-files-custom-sha
|
||||
uses: ./
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-custom-sha.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
@ -149,6 +149,11 @@ jobs:
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files listed above has changed."
|
||||
- name: Use a different commit SHA as the base
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v8.4
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
```
|
||||
|
||||
|
@ -14,6 +14,10 @@ inputs:
|
||||
description: 'Check for changes using only this list of files (Defaults to the entire repo)'
|
||||
required: false
|
||||
default: ""
|
||||
sha:
|
||||
description: 'Specify a different commit SHA to be used for comparing changes'
|
||||
required: true
|
||||
default: ${{ github.sha }}
|
||||
|
||||
outputs:
|
||||
added_files:
|
||||
@ -58,11 +62,11 @@ runs:
|
||||
id: changed-files
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
GITHUB_BASE_REF: ${{ github.base_ref }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
|
||||
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
|
||||
INPUT_SHA: ${{ inputs.sha }}
|
||||
INPUT_TOKEN: ${{ inputs.token }}
|
||||
INPUT_FILES: ${{ inputs.files }}
|
||||
INPUT_SEPARATOR: ${{ inputs.separator }}
|
||||
|
@ -8,10 +8,10 @@ git remote set-url origin "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY
|
||||
|
||||
echo "Getting HEAD info..."
|
||||
|
||||
if [[ -z $GITHUB_SHA ]]; then
|
||||
if [[ -z $INPUT_SHA ]]; then
|
||||
CURR_SHA=$(git rev-parse HEAD 2>&1) && exit_status=$? || exit_status=$?
|
||||
else
|
||||
CURR_SHA=$GITHUB_SHA
|
||||
CURR_SHA=$INPUT_SHA
|
||||
fi
|
||||
|
||||
if [[ $exit_status -ne 0 ]]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user