@@ -59,7 +59,7 @@ All the functions below accept a single object as its argument, and share the fo
5959{
6060 octokit : GitHubClient ;
6161 owner : string ;
62- repository : string ;
62+ repo : string ;
6363 branch : string ;
6464 /**
6565 * Push the commit even if the branch exists and does not match what was
@@ -69,7 +69,7 @@ All the functions below accept a single object as its argument, and share the fo
6969 /**
7070 * The commit message
7171 */
72- message : CommitMessage ;
72+ message : string | CommitMessage ;
7373 log ?: Logger ;
7474}
7575```
@@ -111,12 +111,9 @@ const octokit = getOctokit(process.env.GITHUB_TOKEN);
111111// e.g. if you're just using @ations/checkout
112112await commitChangesFromRepo ({
113113 octokit ,
114- owner: " my-org" ,
115- repository: " my-repo" ,
114+ ... context .repo ,
116115 branch: " new-branch-to-create" ,
117- message: {
118- headline: " [chore] do something" ,
119- },
116+ message: " [chore] do something" ,
120117});
121118
122119// Commit & push the files from a specific directory
@@ -126,21 +123,19 @@ await commitChangesFromRepo({
126123 owner: " my-org" ,
127124 repository: " my-repo" ,
128125 branch: " another-new-branch-to-create" ,
129- message: {
130- headline: " [chore] do something else" ,
131- },
126+ message: " [chore] do something else\n\n some more details" ,
132127 repoDirectory: " /tmp/some-repo" ,
133128});
134129
135130// Commit & push the files from the current directory,
136131// but ensure changes from any locally-made commits are also included
137132await commitChangesFromRepo ({
138133 octokit ,
139- owner: " my-org" ,
140- repository: " my-repo" ,
134+ ... context .repo ,
141135 branch: " another-new-branch-to-create" ,
142136 message: {
143137 headline: " [chore] do something else" ,
138+ body: " some more details" ,
144139 },
145140 base: {
146141 // This will be the original sha from the workflow run,
@@ -183,7 +178,7 @@ In addition to `CommitFilesBasedArgs`, this function has the following arguments
183178Example:
184179
185180``` ts
186- import { getOctokit } from " @actions/github" ;
181+ import { context , getOctokit } from " @actions/github" ;
187182import { commitFilesFromDirectory } from " @s0/ghcommit/fs" ;
188183
189184const octokit = getOctokit (process .env .GITHUB_TOKEN );
@@ -192,12 +187,9 @@ const octokit = getOctokit(process.env.GITHUB_TOKEN);
192187// based on the main branch
193188await commitFilesFromDirectory ({
194189 octokit ,
195- owner: " my-org" ,
196- repository: " my-repo" ,
190+ ... context .repo ,
197191 branch: " new-branch-to-create" ,
198- message: {
199- headline: " [chore] do something" ,
200- },
192+ message: " [chore] do something" ,
201193 base: {
202194 branch: " main" ,
203195 },
@@ -210,12 +202,9 @@ await commitFilesFromDirectory({
210202// Push just the index.html file to a new branch called docs, based off the tag v1.0.0
211203await commitFilesFromDirectory ({
212204 octokit ,
213- owner: " my-org" ,
214- repository: " my-repo" ,
205+ ... context .repo ,
215206 branch: " docs" ,
216- message: {
217- headline: " [chore] do something" ,
218- },
207+ message: " [chore] do something" ,
219208 force: true , // Overwrite any existing branch
220209 base: {
221210 tag: " v1.0.0" ,
@@ -255,20 +244,17 @@ In addition to `CommitFilesBasedArgs`, this function has the following arguments
255244Example:
256245
257246``` ts
258- import { getOctokit } from " @actions/github" ;
247+ import { context , getOctokit } from " @actions/github" ;
259248import { commitFilesFromBuffers } from " @s0/ghcommit/node" ;
260249
261250const octokit = getOctokit (process .env .GITHUB_TOKEN );
262251
263252// Add a file called hello-world
264253await commitFilesFromBuffers ({
265254 octokit ,
266- owner: " my-org" ,
267- repository: " my-repo" ,
255+ ... context .repo ,
268256 branch: " new-branch-to-create" ,
269- message: {
270- headline: " [chore] do something" ,
271- },
257+ message: " [chore] do something" ,
272258 base: {
273259 branch: " main" ,
274260 },
0 commit comments