Automattic / Automattic/action-commit-to-branch

Commits not getting picked up

Open
#9 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Shell
Stars
17
Forks
20
PR merge metrics
No merged PRs in 30d

Description

On the initial run where my built branch (`main-built`) does not exist, everything works as expected. However, when adding subsequent commits to `main`, the action is not committing them to `main-built`. Am I misunderstanding any functionality here?

Example `.yml`:
```
name: Build production to main-built
on:
push:
branches:
- main
jobs:
build_main_job:
runs-on: ubuntu-latest
name: Build production version of main to main-built branch
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Push to built branch
id: commit-and-push
uses: Automattic/action-commit-to-branch@master
with:
branch: 'main-built'
commit_message: 'Automated production build from main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Log from my `.yml`:
```
Fetching origin
No local changes to save
Branch 'main-built' set up to track remote branch 'main-built' from 'origin'.
Switched to a new branch 'main-built'
No stash entries found.
On branch main-built
Your branch is up to date with 'origin/main-built'.

nothing to commit, working tree clean
Branch 'main-built' set up to track remote branch 'main-built' from 'origin'.
Everything up-to-date
```

Is this expected behavior? I had assumed that subsequent commits added to `main` would be picked up by `main-built`, but looking at `entrypoint.sh` that doesn't seem to be the case.

_edit:_ not sure if [this change](https://github.com/jakeols/action-commit-to-branch/commit/39c8387ba37b363f09bf7f78a5cab3a66daa989f) is the correct approach for solving this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with entrypoint.sh and reproduce the provided workflow after creating main-built and then adding a commit to main. Compare the branch checkout and commit conditions in the logs; done means subsequent source changes are correctly reflected in main-built, or the action's expected behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, shell
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.