-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
create_branch
should be for remote only
#295
Comments
Thanks for your feedback/suggestion. Would you be able to share the exact error message you're receiving when running the action with Thanks! |
config:
output:
|
Thank you @mvorisek. So the actual error you're getting is the following.
Which happens – as you correctly noticed – when switching to a new branch locally. I honestly can't remember why we actually switch to a different branch locally, instead of just pointing to the right branch when pushing. This is definitely something I would like to change in v6. To fix your current issues, you would have to switch to the right branch before changing your files. As you didn't provide the entire workflow file in your opening comment, I assume that this workflow is one causing you issues. I can already see some general problems which name: CI
on:
pull_request:
push:
schedule:
- cron: '0 0/2 * * *'
jobs:
build:
if: endsWith(github.head_ref || github.ref_name, '.changes') == false
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
fail-fast: false
permissions:
contents: write
steps:
- uses: actions/checkout@v3
+ - name: Checkout Branch
+ run: git checkout -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}.changes"
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tools
run: |
sudo apt -y install libxml2-utils
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test/requirements.txt
pip install .
- name: Build Unit Tests
run: |
cd test
find . -name '*.html' -exec rm {} \;
make html SPHINXOPTS='-W'
(cd _build/html && rm genindex.html index.html search.html php-modindex.html)
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
- name: Diff Unit Tests Output
run: |
cd test
rm -r _build
git add . -N && git diff --exit-code
+ - run: git pull origin "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}.changes"
- name: Push Unit Tests Output
if: failure()
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref || github.ref_name }}.changes
# create_branch: true
push_options: '--force'
commit_message: Unit Tests Changes
commit_user_name: Bot
commit_user_email: [email protected]
commit_author: Bot <[email protected]>
- name: Build Unit Tests with toc show_parents=hide
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
- name: Build Unit Tests with toc show_parents=domain
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
- name: Build Unit Tests with toc show_parents=all
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all' (I haven't tested this code, but in theory something like this should work) But I want to point out some problems you might run into with such a workflow.
|
I just also noticed, that you might run into issues with your workflow, if triggered by the scheduler: The
It would probably be safer to checkout the - uses: actions/checkout@v3
with:
ref: 'main' |
Thank you for the detailed replies. This PR is about |
git-auto-commit Version
4.16.0 / latest
Machine Type
Ubuntu (eg. ubuntu-latest)
Bug description
cannot force push the remote branch even if it exists remotely
Expected behaviout
Notice, the
create_branch
option in the repro above is commented/disabled. When enabled, all works as expected.create_branch
should apply for remote branch creation only. In CI, an option for creating local branch has almost no sense. The important thing is if the branch is existing on the remote or not.The text was updated successfully, but these errors were encountered: