-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
51 lines (41 loc) · 1.97 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
48
49
50
51
name: get_related_branch_from_repo
description: >
Get the related branch from a remote repository.
In case the event triggering the workflow is a "pull_request", the branch deduction is as follows:
1. The action will look for the PR's source branch in the remote repository.
2. If the PR's source branch is not found and this step is not skipped, the action will look for the PR's base branch in the remote repository.
3. If the PR's base branch is not found or skipped, the action will look for the fallback branch in the remote repository.
4. If the fallback branch is not found, the action will fail.
In case the event triggering the workflow is not a "pull_request", the action will look for the fallback branch in the remote repository, and fail if it is not found.
inputs:
remote_repository:
description: >
The remote repository from which to get the related branch.
Format: owner/repo (e.g.: eProsima/Fast-DDS).
required: true
fallback_branch:
description: >
The branch to use if no candidate branch can be found in the remote repository.
This is the only branch that is checked for existence in the remote repository in events other that "pull_request".
required: true
skip_base:
description: >
Skip the base branch deduction in case the PR's source branch is not found.
This is useful when the base branch is not relevant for the workflow.
required: false
default: false
outputs:
deduced_branch:
description: "Deduced branch"
value: ${{ steps.deduce_branch.outputs.deduced_branch }}
runs:
using: composite
steps:
# Both Windows, MacOS and Ubuntu can run this bash script
- name: Get related branch from remote repository
id: deduce_branch
uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@main
with:
remote_repository: ${{ inputs.remote_repository }}
fallback_branch: ${{ inputs.fallback_branch }}
skip_base: ${{ inputs.skip_base }}