-
Notifications
You must be signed in to change notification settings - Fork 13
/
action.yaml
93 lines (82 loc) · 2.41 KB
/
action.yaml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# vim:ts=2:sts=2:sw=2:et
#
# Author: Hari Sekhon
# Date: [% DATE # 2022-06-07 12:38:18 +0100 (Tue, 07 Jun 2022) %]
#
# [% URL # https://github.com/HariSekhon/GitHub-Actions %]
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
---
name: NAME
description: DESCRIPTION
# ==================
inputs:
debug:
description: Enable Debug Mode
type: boolean
required: false
default: false
# ==================
outputs:
random-number:
description: "Random number"
value: ${{ steps.random-number-generator.outputs.random-number }}
# ==================
# not supported yet:
#
# https://github.com/github-community/community/discussions/18597
#
#defaults:
# run:
# shell: bash -euxo pipefail {0}
# ==================
# pick one of:
#
# - Composite (shell steps)
# - Docker (entrypoint)
# - JavaScript action (main.js)
runs:
# Docker Action
#
# Dockerfile contain something like:
#
# FROM alpine:3.10
# COPY entrypoint.sh /
# ENTRYPOINT ["/entrypoint.sh"]
# XXX: Do not set USER - won't be able to access $GITHUB_WORKSPACE
# XXX: Do not set WORKSPACE - will be overridden by $GITHUB_WORKSPACE
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions
#
#using: docker
#image: Dockerfile
#entrypoint: /entrypoint.sh # entrypoint overrides Dockerfile's ENTRYPOINT - prefer Dockerfile
#args: # args override Dockerfile's CMD - leave sensible defaults so args aren't needed
# - ${{ inputs.debug }}
# Composite Action
using: composite
steps:
# has to use | format to avoid syntax error for having a colon in the message body
- run: |
echo "Debug mode enabled: $DEBUG"
env:
DEBUG: ${{ inputs.debug }}
# XXX: shell is a mandatory required parameter for now:
#
# https://github.com/github-community/community/discussions/18597
#
shell: bash
- id: random-number-generator
run: echo "::set-output name=random-number::$(echo $RANDOM)"
shell: bash
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
shell: bash
- run: ./script.sh # in the actions repo
# JavaScript Action
#
#using: node16
#main: index.js