Prepare config handling for the upcoming GitHub Action#1980
Merged
dscho merged 6 commits intomaingitgitgadget/gitgitgadget:mainfrom Aug 21, 2025
prepare-config-handlinggitgitgadget/gitgitgadget:prepare-config-handlingCopy head branch name to clipboard
Merged
Prepare config handling for the upcoming GitHub Action#1980dscho merged 6 commits intomaingitgitgadget/gitgitgadget:mainfrom prepare-config-handlinggitgitgadget/gitgitgadget:prepare-config-handlingCopy head branch name to clipboard
dscho merged 6 commits intomaingitgitgadget/gitgitgadget:mainfrom
prepare-config-handlinggitgitgadget/gitgitgadget:prepare-config-handlingCopy head branch name to clipboard
Conversation
It really needs to be reusable instead of being stuck in the script. In particular since we're about to modify GitGitGadget such that it can be run as a GitHub Action instead. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
It was a bit hard for me to follow the code, getting confused by two separate `getConfig()` functions that do different things (the one from `gitgitgadget-config` initializes the default config, the one from `project-config` gets a singleton that might still be uninitialized). Let's unconfuse things by making the config a parameter of the constructor. It can still be omitted, in which case the default config is used. Note: This commit is only concerned with the CIHelper class, because we will use it from light-weight GitHub Actions in the future. The rest of the code really needs to use the singleton up until the time when we'll get around to The Big Refactor. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When no `workDir` is specified, default to using the `git.git/` subdirectory in the current directory. This will be initialized as a bare repository in the upcoming GitHub Actions. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In #1974, I changed the way the push token is handed down from CIHelper to GitGitGadget instead of relying on the Git config (or environment) to specify it implicitly. Let's do the same for the URL of the repository to which to push the Git notes and patch series iterations' tags. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
One of the primary goals of GitGitGadget is to send emails. So far, the configuration for sending those is provided via environment variables or via the Git config. This is _implicit_, and I want to make this _explicit_ in preparation for the upcoming conversion to a set of GitHub Actions. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The future of GitGitGadget is that it comes in the form of a set of GitHub Actions; Most won't send emails and therefore do not need the SMTP configuration, so let's not require it in those instances. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Member
Author
Well, to be precise, #1473 would then have been part 0 ;-) |
mjcheetham
approved these changes
Aug 20, 2025
This was referenced Aug 20, 2025
webstech
reviewed
Aug 21, 2025
webstech
reviewed
Aug 21, 2025
dscho
added a commit
that referenced
this pull request
Aug 26, 2025
This PR is part 3 of addressing #609, and it is stacked on top of #1980 and #1981 (and therefore contains also the commits of those PRs), therefore I will leave this in draft mode until those PRs are merged. The grand idea is to bundle the `CIHelper` class together with all its direct and transitive dependencies into one big, honking `dist/index.js`, and then add a set of really minimal GitHub Actions that call into `CIHelper`. The Actions are added in sub-directories so that they can be called in GitHub workflows via e.g. `- uses: gitgitgadget/gitgitgadget/update-prs@1`. The component used for bundling `CIHelper` is [`@vercel/ncc` ](https://www.npmjs.com/package/@vercel/ncc). To support acting as a GitHub Action, [`@actions/core`](https://www.npmjs.com/package/@actions/core) is installed. To allow for really minimal GitHub Actions, the `CIHelper` class is augmented accordingly to re-implement more logic that is currently either in `misc-helper.ts` or in the (non-public 😞) Azure Pipelines definitions. The naming convention for specifying the necessary tokens as GitHub Actions inputs is: - `upstream-repo-token`: This is to comment on PRs in `git/git` - `pr-repo-token`: This is to comment on PRs in `gitgitgadget/git` (as well as to be able to push to that repository) - `test-repo-token`: This is to comment on PRs in `dscho/git` (used exclusively for testing) To clarify, here is a diagram: ```mermaid graph TD user["user (contributor)"] upstream-repo["upstream-repo (authoritative project repo)"] pr-repo["pr-repo (GitGitGadget-enabled GitHub repo)"] GitGitGadget["GitGitGadget"] mailing-list["mailing-list"] user -->|"opens PR"| pr-repo user -->|"opens PR (if GitHub App installed)"| upstream-repo upstream-repo -->|"GitGitGadget syncs branches to"| pr-repo pr-repo -->|"slash commands"| GitGitGadget upstream-repo -->|"slash commands (if App installed)"| GitGitGadget GitGitGadget -->|"sends patch series"| mailing-list ```
dscho
added a commit
that referenced
this pull request
Aug 27, 2025
Publish the GitHub Actions to a separate branch This PR is part 4 (the final part in this repository) of addressing #609, and it is stacked on top of #1980, #1981, and #1982 (and therefore contains also the commits of those PRs), therefore I will leave this in draft mode until those PRs are merged. After laying the groundwork for, and implementing, the set of GitHub Actions that can perform the same job as GitGitGadget's current Azure Pipelines can perform, this here PR adds automation to 1. transpile the `CIHelper` class (together with its dependencies) from Typescript to JavaScript, 2. bundle it as a single, dependency-less `dist/index.js`, 3. copy the required resources (`WELCOME.md`, some shell scripts) into the location expected by that `dist/index.js`, 4. remove all the rest except for the minimal GitHub Actions (`*/action.yml`, `*/index.js`), 5. commit the result as the new tip commit of the `v1` branch (creating it as needed), 6. tag that tip commit as `v1.<running-number>`, 7. push out the `v1` branch and the tag. The result of this is that GitGitGadget can still be developed conveniently in this here repository, and whenever anything gets merged to the `main` branch, the `v1` branch is automatically updated so that it will be picked up by GitHub workflows containing statements like: ```yaml - uses: gitgitgadget/gitgitgadget/handle-pr-comment@v1 ``` That way, we _finally_ address the fragile nature of the current setup where a set of Azure Pipelines maintain their own clone of `gitgitgadget/gitgitgadget`, and having to run `npm ci && npm run build` as needed. This closes #1759
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part 1 of going for the idea to switch from Azure Pipelines to GitHub workflows.
In this PR, I tried to break out the commits into their own change set which are concerned with setting up GitGitGadget to do its work, including the configuration which repositories to clone and where to.