-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
47 lines (43 loc) · 1.69 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: "Release Info Action"
author: "Aaron Batilo"
description: "An action to read release information of a given GitHub repository"
branding:
icon: "package"
color: "gray-dark"
inputs:
owner:
description: "The user or org for this repo"
required: true
repo:
description: "The name of the repo itself"
required: true
outputs:
latest_tag:
description: "The latest release version tag"
value: ${{ steps.fetch-info.outputs.latest_tag }}
latest_tag_published_at:
description: "The ISO8601 timestamp of when this version was released"
value: ${{ steps.fetch-info.outputs.latest_tag_published_at }}
target_commitish:
description: "Specifies the commitish value that determines where the git tag is created from. Can be any branch or commit SHA."
value: ${{ steps.fetch-info.outputs.target_commitish }}
runs:
using: "composite"
steps:
- id: fetch-info
shell: bash
run: |
set -o errexit
set -o pipefail
owner="${{ inputs.owner }}"
repo="${{ inputs.repo }}"
release_json=$(curl https://api.github.com/repos/$owner/$repo/releases/latest)
latest_tag=$(echo "$release_json" | jq -r '.tag_name')
latest_tag_published_at=$(echo "$release_json" | jq -r '.published_at')
target_commitish=$(echo "$release_json" | jq -r '.target_commitish')
echo "latest_tag: $latest_tag"
echo "latest_tag_published_at: $latest_tag_published_at"
echo "target_commitish: $target_commitish"
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
echo "latest_tag_published_at=$latest_tag_published_at" >> $GITHUB_OUTPUT
echo "target_commitish=$target_commitish" >> $GITHUB_OUTPUT