-
Notifications
You must be signed in to change notification settings - Fork 117
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
Automating regeneration of Info file #379
Comments
Looks good to me! |
Looks good to me, too! Thanks for digging into this. |
So after I thought I had fixed the issue (from Meaning the target branch doesn't get the updated info buffer, but the source branch of the merge does ... after the merge. I'll look into this more and see if there is an "before merging" or something |
After some more research, it seems there is no way to push to the target branch on PR. We could simply run the action on the "main" branch (currently However, if someone forks, they have to create a new branch before committing (e.g. to make a PR), otherwise the Action will trigger for them. Thoughts? |
Umm... That's interesting. So forking this repo will get all the "extras" like this (and possibly linting in the future)... that's sorta unfortunate. I'd like to see that stuff here, but I'm not sure I want to inflict it on someone who forks the repo.
This seems fine to me though and I'd support this.
I'm not sure we have (or should have) that level of control on someone else's fork... I mean, if they just want to push on their fork, they can do what they want. We might need to check the settings on this project and make sure only maintainers can commit and/or merge PRs and avoid possible "oopsie!" from happening. |
The last resort could also be to manually run the Action, however it somewhat defeats the point of having the action (except for ensuring a cleanly built info file, but the Makefile already does that) ... People can remove the |
Some more experimentation later, it seems I found the solution. (I used name: regenerate-info
on:
pull_request:
types:
- closed
paths:
- docs/*.org
branches:
- main
jobs:
regenerate-info:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install Emacs
uses: purcell/setup-emacs@master
with:
version: 29.1
- name: Generate info
working-directory: ./docs
run: make
- uses: stefanzweifel/git-auto-commit-action@v5
with:
# This basically says "push to main"
branch: main
commit_message: Regenerate info buffer Note that this does not work around the issue where this is still active when someone forks Crafted Emacs. |
I guess that makes sense. I'd rather have the automation than worry about someone else having the same actions etc we have in their forks. We might mention that on the README somewhere under a section like "Forking this project" just so people are aware of the actions, etc that come with the project and how they might prefer to ignore / disable / remove those things. |
Well, come to think of it, with the new version, it would only trigger an Action if the fork had a PR on itself to merge into the "main" of the fork (not on push) ... which seems unlikely (at least for now). |
Yeah, that's a good point as well. |
Much of the technical details of Github Actions are beyond me, so I'll keep out of that part of the discussion. And I certainly don't want to stop you - @jvdydev - from tinkering with something that you enjoy. So, if you do enjoy it, knock yourself out. If you don't, two thoughts:
|
Here are my thoughts:
|
I mainly started this with the goal of having to "not think about" something that seemed like it can be automated (somewhat) easily. Generally, I think having the info file generated by the user on startup is not necessarily the solution as Emacs is not the only place to read info files (e.g. Regarding git hooks, that could work, I wonder if it would be a little slow (given there is not really any "incremental" building of the info file). I like the idea of having versioning (e.g. through Milestones or similar). |
From time to time, we get merge conflicts because two PRs change documentation, which results in both regenerating the info file (thus leading to a merge issue).
It also has happened that regeneration was forgotten.
Therefor, we want to move the building of the info file into CI.
I threw together a small workflow, however I first want to give anyone interested the chance to discuss (improvements, optimizations, ...).
The current workflow (branch set to
craftedv2RC1
, eventually this would becomemaster
):This would rebuild the info file if any org file in the
docs
directory changed.The newly built info file would then be committed by the last committer (co-authored by gihub-actions bot).
Discussion welcome 😄
The text was updated successfully, but these errors were encountered: