31 lines
1.2 KiB
YAML
31 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: Parse event
|
|
id: parse
|
|
shell: powershell
|
|
run: |
|
|
chcp 65001 > $null
|
|
$event = Get-Content "${{ github.event_path }}" | ConvertFrom-Json
|
|
$serverUrl = "${{ github.server_url }}"
|
|
$host = $serverUrl -replace '.*://', ''
|
|
|
|
Write-Output "OUT: hash=$($event.before)"
|
|
Write-Output "hash=$($event.before)" | Add-Content -Path $env:GITHUB_OUTPUT
|
|
|
|
Write-Output "OUT: count=$($event.commits.Count + 1)"
|
|
Write-Output "count=$($event.commits.Count + 1)" | Add-Content -Path $env:GITHUB_OUTPUT
|
|
|
|
Write-Output "ENV: CI_SERVER_HOST=$host"
|
|
Write-Output "CI_SERVER_HOST=$host" | Add-Content -Path $env:GITHUB_ENV |