38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: 'parse-event'
|
|
description: 'Parses a JSON file, that contains all information about the last event.'
|
|
|
|
outputs:
|
|
base-commit:
|
|
description: 'The hash of the base commit of the event. This is the commit that was previously at the head of the branch before the event.'
|
|
value: ${{ steps.parse.outputs.hash }}
|
|
fetch-depth:
|
|
description: 'The number of commits needed to get the whole diff of the event.'
|
|
value: ${{ steps.parse.outputs.count }}
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Install jq
|
|
shell: bash
|
|
run: |
|
|
apt-get update &> /dev/null
|
|
apt-get install -y jq &> /dev/null
|
|
echo "$(which jq): $(jq --version)"
|
|
|
|
- name: Parse event
|
|
id: parse
|
|
shell: bash
|
|
run: |
|
|
hash=$(jq -r '.before' "${{ github.event_path }}")
|
|
count=$(jq -r '.commits | length + 1' "${{ github.event_path }}")
|
|
serverUrl="${{ github.server_url }}"
|
|
host=${serverUrl#*://}
|
|
|
|
echo "OUT: hash=$hash"
|
|
echo "hash=$hash" >> $GITHUB_OUTPUT
|
|
|
|
echo "OUT: count=$count"
|
|
echo "count=$count" >> $GITHUB_OUTPUT
|
|
|
|
echo "ENV: CI_SERVER_HOST=$host"
|
|
echo "CI_SERVER_HOST=$host" >> $GITHUB_ENV |