2
2
3
3
## What this action does
4
4
5
- This action manages 2 workflows out of the box (push, pr ) and essentially does two things :
5
+ This action manages 2 workflows out of the box (** push** , ** pr ** ) and essentially has three steps :
6
6
7
7
1 . ** Detect** which workflow to run depending on the context:
8
8
9
9
- _ Push to SoT_ => ** push**
10
- - _ PR opened/changed on destination_ => ** pr**
10
+ - _ PR opened/updated on destination_ => ** pr**
11
11
12
12
> If the destination branch doesn't exist on ** push** , it will add the flags ` --force --init-history `
13
13
14
14
2 . ** Generate** a configuration for each workflow
15
15
16
+ 3 . ** Run** Copybara
17
+
16
18
## What you can do
17
19
18
20
### Force specific workflows
19
21
20
- The following will ensure the ** push** workflow is ran using the auto-generated configuration file.
22
+ _ The following will let you override step 1 but let Copybara Action perform step 2 and 3._
23
+
24
+ It will ensure the ** push** workflow is ran using the auto-generated configuration file.
21
25
22
26
``` yaml
23
27
on :
@@ -32,22 +36,25 @@ jobs:
32
36
33
37
34
38
with :
39
+ ssh_key : ${{ secrets.SSH_KEY }}
35
40
sot_repo : your/repo
36
41
destination_repo : other/repo
37
42
workflow : push
38
- ssh_key : ${{ secrets.SSH_KEY }}
39
43
` ` `
40
44
41
45
### Custom Copybara configuration
42
46
43
- The following will use your configuration instead of the automatically generated one.
47
+ _The following will let Copybara Action perform step 1 and 3 but let you override step 2._
48
+
49
+ It will use your configuration instead of the automatically generated one.
44
50
You can get inspiration from the [generated config](#generated-config) to get started.
45
51
46
52
> This example is still making use of the workflow detection so ` my.own.copy.bara.sky` must contain a **push** and a **pr** workflow
47
53
48
54
` ` ` yaml
49
55
on:
50
56
push:
57
+ pull_request_target:
51
58
jobs:
52
59
move-code:
53
60
runs-on: ubuntu-latest
@@ -58,15 +65,18 @@ jobs:
58
65
59
66
60
67
with:
68
+ access_token: ${{ secrets.GH_TOKEN }}
69
+ ssh_key: ${{ secrets.SSH_KEY }}
61
70
sot_repo: your/repo
62
71
destination_repo: other/repo
63
72
custom_config: my.own.copy.bara.sky
64
- ssh_key: ${{ secrets.SSH_KEY }}
65
73
` ` `
66
74
67
75
# ## Completely custom
68
76
69
- The following doesn't make use of any of our helpers for detecting the workflow and generating the configuration.
77
+ _The following will let you override step 1, 2 and let you customize how Copybara Action will perform step 3._
78
+
79
+ It doesn't make use of any of our helpers for detecting the workflow and generating the configuration.
70
80
It is even using a custom Copybara docker image!
71
81
72
82
` ` ` yaml
@@ -82,16 +92,18 @@ jobs:
82
92
83
93
84
94
with:
85
- workflow: export
95
+ access_token: ${{ secrets.GH_TOKEN }}
96
+ ssh_key: ${{ secrets.SSH_KEY }}
97
+ workflow: create
86
98
custom_config: my.own.copy.bara.sky
87
99
copybara_image: sharelatex/copybara
88
- ssh_key: ${{ secrets.SSH_KEY }}
100
+ copybara_options: --force --init-history
89
101
` ` `
90
102
91
103
# ## SoT not on GitHub
92
104
93
- This action's auto-generated configuration was made for a use case with two GitHub repos. However
94
- If your SoT is not on GitHub, you can still use this action on your destination using a custom config and forcing a specific workflow :
105
+ This action's auto-generated configuration was made for a use case with two GitHub repos. However, if your SoT is not on GitHub, this action is still helpful.
106
+ Use it on your destination with a custom config and a specific workflow :
95
107
96
108
` ` ` yaml
97
109
on:
@@ -102,21 +114,20 @@ jobs:
102
114
steps:
103
115
104
116
with:
117
+ ssh_key: ${{ secrets.SSH_KEY }}
105
118
workflow: pr
106
119
custom_config: my.own.copy.bara.sky
107
- ssh_key: ${{ secrets.SSH_KEY }}
108
120
` ` `
109
121
110
122
# ## [More options](inputs.md)
111
123
112
124
# # Generated config
113
125
114
- So you don't have to start your config from scratch, let's download your current generated one.
115
-
116
- When you enable debug mode, this action will create an artifact containing your copy.bara.sky configuration.
126
+ So you don't have to start your custom config from scratch, you can download the generated one.
117
127
118
128
1. In your repo(s), add the secret `ACTIONS_STEP_DEBUG` and set it to `true`
119
- 2. Run the action workflow (most likely create a commit in SoT and a PR in destination)
120
- 3. Check out the artifacts for this workflow run
129
+ 2. Run the action workflow (ie. push a commit to SoT and create a PR in destination)
130
+ 3. Check out the artifacts for your action workflow runs
121
131
132
+ It will look like this :
122
133

0 commit comments