-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
37 lines (33 loc) · 1.1 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
name: Promote action in actions monorepo
description: |
Given a monorepo composed of multiple action folders, deletes all other actions and moves all the
contents of the main action to the root of the repo.
inputs:
action_name:
description: 'The name of the action'
required: true
runs:
using: "composite"
steps:
- name: Promote action
id: promote
shell: bash
run: |
ACTION_DIR="${{ inputs.action_name }}"
if [[ ! -d "./$ACTION_DIR" ]]; then
echo "The action folder $ACTION_DIR does not exist!"
exit 1
fi
if [[ ! -f "./$ACTION_DIR/action.yml" ]]; then
echo "The action folder $ACTION_DIR does not contain an action.yml file!"
exit 1
fi
# Remove all non-dotted directories from root
git rm -r ./*
# Restore the action we want to keep
git reset HEAD -- "./${ACTION_DIR}"
git checkout -- "./${ACTION_DIR}"
# Move the action files to root
git mv "./${ACTION_DIR}/"* .
echo "Remaining files:"
ls -al