Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support custom repository and working-directory #23

Merged
merged 4 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@ inputs:
message:
description: The commit message
required: true
owner:
description: The owner of the GitHub repo, defaults to the owner of the repository this action is running in
required: false
ref:
description: Git reference to associate the commit with (e.g. `main`). If it does not exist it will be created. Defaults to the the current checkout ref.
required: false
repository:
description: The GitHub repository to commit to, defaults to the repository this action is running in
required: false
token:
description: The GitHub app installation token
required: true
working-directory:
description: The working directory, defaults to the current working directory
required: false

outputs:
message:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as process from 'node:process';

import * as core from '@actions/core';
import * as github from '@actions/github';
Expand Down Expand Up @@ -71,6 +72,13 @@ export async function run(): Promise<void> {
const ref = core.getInput('ref') || (await getHeadRef());
const failOnNoChanges = core.getBooleanInput('fail-on-no-changes');
const force = core.getBooleanInput('force');
const owner = core.getInput('owner') || github.context.repo.owner;
const repo = core.getInput('repository') || github.context.repo.repo;
const workingDirectory = core.getInput('working-directory');

if (workingDirectory) {
process.chdir(workingDirectory);
}

const tree = await populateTree();

Expand All @@ -83,8 +91,6 @@ export async function run(): Promise<void> {
return;
}

const owner = github.context.repo.owner;
const repo = github.context.repo.repo;
const octokit = github.getOctokit(token, { log: console });

// Upload file contents as blobs and update the tree with the returned SHAs
Expand Down
Loading