Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

More prerequisites to move GitGitGadget towards GitHub Actions#1981

Merged
dscho merged 7 commits intomaingitgitgadget/gitgitgadget:mainfrom
more-gitgitgadget-github-actions-prerequisitesgitgitgadget/gitgitgadget:more-gitgitgadget-github-actions-prerequisitesCopy head branch name to clipboard
Aug 22, 2025
Merged

More prerequisites to move GitGitGadget towards GitHub Actions#1981
dscho merged 7 commits intomaingitgitgadget/gitgitgadget:mainfrom
more-gitgitgadget-github-actions-prerequisitesgitgitgadget/gitgitgadget:more-gitgitgadget-github-actions-prerequisitesCopy head branch name to clipboard

Conversation

@dscho
Copy link
Member

@dscho dscho commented Aug 20, 2025

After part 1 (#1980), this is part 2 of addressing #609. It is a stacked PR, with two more to follow in this here repository.

The themes of the patches included in this PR are:

  • addressing various bugs in existing code paths that aren't yet exercised, but will be
  • undoing the previous attempts at adding GitHub Actions on top of GitGitGadget, and
  • lay the ground-work to add minimal pure-JavaScript GitHub Actions on top CIHelper.

dscho added 7 commits August 20, 2025 10:01
When I authored 176113f (git: allow operating on bare repositories,
2023-10-01), I obviously tested only with absolute `workDir` values.
Let's make it work with relative ones, too, by avoiding to override the
working directory _in addition_ to specifying `--git-dir=<path>`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Right now, there is no problem: GitGitGadget uses a couple of Azure
Pipelines that all run on the same, single runner inside a dedicated
pool, and this runner has a persistent clone of the `gitgitgadget/git`
repository.

However, my current plan is to migrate to GitHub Actions, away from
that self-hosted runner, which means that there is no persistent clone
to work with. Therefore, a local Git repository has to be initialized in
every workflow run, and to make that efficient (and fast!), only the
minimal set of refs is fetched. That idea works only when preventing
Git from _implicitly_ fetching all tags, so let's do that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
That script wants to ensure that the remote called `gitster` is
registered, but when it is not, it registers it with the URL
https://github.com/git/git. That is misleading.

All the script wanted from the gitster/git repository was the `seen`
branch, anyway, and the git/git repository does have that.

So let's just refer to it as `upstream/seen`, as is done elsewhere in
GitGitGadget's code base.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In b6d1ca5 (scripts: make shell scripts generic with new vars,
2022-01-19), the error messages were made more generic by abstracting
the concrete URLs into variables. However, in one instance, the variable
name was misspelled.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…tion

In preparation for a different approach, remove what had been done in
5e0129b (Merge pull request #1055 from webstech/action, 2022-07-20)

I would like to go into a different direction:

- move pretty much all the core logic from `misc-helper` to `CIHelper`.

- use `ncc` to bundle `CIHelper` as a single `dist/index.js` file.

- add dedicates GitHub Actions in subdirectories that contain really
  small `index.js` files which in turn import the `CIHelper` and then
  let it do its magic.

As a consequence, the Azure Pipelines we currently use can then be
migrated to GitHub workflows in gitgitgadget/gitgitgadget-workflows and
use the Actions like this:

  - uses: gitgitgadget/gitgitgadget/handle-slash-command@v1
    with:
      repository: gitgitgadget/git
      pr-number: ...
      issue-comment-id: ...
      gitgitgadget-app-id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
      gitgitgadget-private-key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
      gitgitgadget-git-app-id: ${{ secrets.GITGITGADGET_GIT_GITHUB_APP_ID }}
      gitgitgadget-git-private-key: ${{ secrets.GITGITGADGET_GIT_GITHUB_APP_PRIVATE_KEY }}

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
I am about to add some JavaScript code, where semicolons are frequently
unneeded. Let's skip them there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho self-assigned this Aug 20, 2025
@dscho
Copy link
Member Author

dscho commented Aug 20, 2025

Since this is a PR stacked on top of #1980 (and therefore contains also the commits of that PR), I'll leave it in draft mode until that PR is merged.

@webstech
Copy link
Contributor

No issues with the part 2 unique commits.

@dscho dscho marked this pull request as ready for review August 21, 2025 10:37
@dscho dscho force-pushed the more-gitgitgadget-github-actions-prerequisites branch from 902f7dd to a4b8693 Compare August 21, 2025 10:40
Copy link

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dscho dscho merged commit 6416a6b into main Aug 22, 2025
11 checks passed
@dscho dscho deleted the more-gitgitgadget-github-actions-prerequisites branch August 22, 2025 09:22
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.