Skip to content

Commit

Permalink
Push latest build
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Oct 12, 2021
1 parent 6c1a458 commit 457e504
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@ GitHub Action to keep a branch in sync with the current branch

</div>

## Inputs

### `branch`

**Required** The name of the branch to sync with the current branch.

### `token`

**Required** A GitHub token with permission to push to the repo. [Generate a new token](https://github.com/settings/tokens/new?description=Sync%20Branch&scopes=repo).

### `force`

Whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`.

## Usage

Here's an example workflow that syncs a `test` branch every time a commit is pushed to the `main` branch:
Expand All @@ -36,11 +22,25 @@ jobs:
name: Update test branch
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- uses: connor-baer/action-sync-branch@v1
with:
branch: test
token: ${{ secrets.GITHUB_TOKEN }}
force: false
- name: Checkout repository
uses: actions/checkout@master
- uses: connor-baer/action-sync-branch@master
with:
branch: test
token: ${{ secrets.GITHUB_TOKEN }}
force: false
```
## Inputs
### `branch`

**Required** The name of the branch to sync with the current branch.

### `token`

**Required** A GitHub token with permission to push to the repo. [Generate a new token](https://github.com/settings/tokens/new?description=Sync%20Branch&scopes=repo).

### `force`

Whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const branch = core.getInput('branch');
const force = core.getInput('force') === 'true';
const force = core.getBooleanInput('force');
const token = core.getInput('token');
const octokit = github.getOctokit(token);
const { ref, repo, sha } = github.context;
Expand All @@ -50,7 +50,7 @@ function run() {
core.warning(`'${branch}' is already up to date with '${baseBranch}', skipping.`);
return;
}
core.debug(`Fast-forwarding '${branch}' to '${ref}'...`);
core.info(`Fast-forwarding '${branch}' to '${ref}'...`);
yield octokit.rest.git.updateRef(Object.assign(Object.assign({}, repo), { ref: `heads/${branch}`, sha,
force }));
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = require('@sumup/foundry/lint-staged')({
language: 'TypeScript',
});
module.exports = require('@sumup/foundry/lint-staged')(
{ language: 'TypeScript' },
{ '*.ts': () => 'yarn build' },
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "action-sync-branch",
"version": "1.0.0",
"version": "1.0.1",
"description": "GitHub Action to keep a branch in sync with the current branch",
"main": "lib/main.js",
"scripts": {
Expand Down

0 comments on commit 457e504

Please sign in to comment.