Skip to content

Commit bd065a1

Browse files
committed
docs: add readme and changelog
1 parent a3b2ff4 commit bd065a1

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## Unreleased
8+
### Added
9+
- v1 of the Reusable Workflow Context

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Reusable Workflow Context
2+
3+
Reusable Workflow Context is a GitHub Action that enables you to access reusable workflow context within a running reusable workflow. This action is intended to address the limitations of GitHub. Namely the fact that [neither reusable workflow ref nor reusable workflow sha are available in the context of a running reusable workflow](https://github.com/actions/toolkit/issues/1264).
4+
5+
## Usage
6+
7+
To use the action, add the following step to your GitHub Actions reusable workflow:
8+
9+
```
10+
- id: reusable-workflow
11+
name: Retrieve reusable workflow context
12+
uses: ipdxco/reusable-workflow-context@v1
13+
with:
14+
path: the-name-of-the-reusable-workflow.yml
15+
```
16+
17+
See the [example reusable workflow](./.github/workflows/reusable.yml) that we use to [test](./.github/workflows) this action.
18+
19+
### Inputs
20+
21+
* `path`: The path where the reusable workflow is located. Required. We suggest using the name of the reusable workflow as the path.
22+
23+
### Outputs
24+
25+
* `ref`: For a reusable workflow executing an action, this is the ref of the reusable workflow being executed.
26+
* `sha`: For a reusable workflow executing an action, this is the sha of the reusable workflow being executed.
27+
28+
## How it works
29+
30+
The action uses GitHub API to retrieve the reusable workflows referenced by the current worfklow run. It then filters the reusable workflows based on the path input and selects the first matching workflow. Finally, it exposes the `ref` and `sha` of the reusable workflow it found.
31+
32+
## Known limitations
33+
34+
1. If you use multiple reusable workflows in your workflow, you should watch out for possible path clashes.
35+
2. If you use multiple instances of a reusable workflow with different ref/sha, you should be concious of the fact that the action will only return the ref/sha of the first instance of the reusable workflow that it finds in each instance.
36+
3. If you use request a reusable workflow by sha, the ref output of the action will be empty.
37+
38+
---

0 commit comments

Comments
 (0)