Skip to content

Add two sources to support use as actions - #1055

Merged
dscho merged 1 commit into
gitgitgadget:mainfrom
webstech:action
Jul 20, 2022
Merged

Add two sources to support use as actions#1055
dscho merged 1 commit into
gitgitgadget:mainfrom
webstech:action

Conversation

@webstech

Copy link
Copy Markdown
Contributor

A couple of thin layers to allow gitgitgadget functions to be accessed from GitHub actions. The actions are similar to misc-helper but more specialized. Currently, nothing is published as a package. Action providers must run npm pack on gitgitgadget and specify the package on the npm install command in the action repo.

pull-action is used for pull request related events (create, synchronize, comment).

misc-action is used for other scheduled events such as checking mailing list emails.

Add *.tgz to .gitignore for untracked package.

`pull-action` is used for pull request related events (create,
synchronize, comment).

`misc-action` is used for other scheduled events such as checking
mailing list emails.

Add *.tgz to .gitignore for untracked package.

Signed-off-by: Chris. Webster <[email protected]>
@webstech
webstech requested a review from dscho July 20, 2022 06:37
@webstech

Copy link
Copy Markdown
Contributor Author

Sample repo with two actions using the new functions. These could (should) be part of gitgitgadget. The doc suggests all actions should be in separate repos but it is not mandatory. Since these could be used by external projects using gitgitgadget, should they be in separate projects?

@dscho dscho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you so much for pushing this along!

@dscho
dscho merged commit 5e0129b into gitgitgadget:main Jul 20, 2022
@dscho

dscho commented Jul 20, 2022

Copy link
Copy Markdown
Member

Since such a lot of code is shared, I would think that it makes sense to keep things in a single repository.

I would be in favor of refactoring so that it is a single Action running in different modes.

Eventually, I want to use ncc to pack everything into a single (committed) .js file, much like I do it in setup-git-for-windows-sdk: https://github.com/git-for-windows/setup-git-for-windows-sdk/commits/7da470f0d3b358ecffc95788839430faab761963/dist

@webstech

Copy link
Copy Markdown
Contributor Author

Since such a lot of code is shared, I would think that it makes sense to keep things in a single repository.

The actions in the sample have a duplicated setupGitEnvironment() but that is about it. The reason for separate repos is to keep the workflow invocation cleaner. This is a bit verbose:

uses: webstech/gitgitgadget-pr-action/.github/actions/pull-request@main

(location suggested in GitHub docs for multi-action repo).

I would be in favor of refactoring so that it is a single Action running in different modes.

The pull request action has different inputs so it should have its own action.yml. The code could check what action was running and do the appropriate work but it does make it more complex.

Eventually, I want to use ncc

The sample is doing this. The outputs are in the same folders as the action.yml.

@dscho

dscho commented Jul 26, 2022

Copy link
Copy Markdown
Member

Since such a lot of code is shared, I would think that it makes sense to keep things in a single repository.

The actions in the sample have a duplicated setupGitEnvironment() but that is about it. The reason for separate repos is to keep the workflow invocation cleaner. This is a bit verbose:

uses: webstech/gitgitgadget-pr-action/.github/actions/pull-request@main

(location suggested in GitHub docs for multi-action repo).

I agree, this would be ugly.

But maybe we can use the shorter names gitgitgadget/pr and gitgitgadget/push? FWIW feel free to move your repository into the gitgitgadget org, unless you want to play with it more before moving it.

would be in favor of refactoring so that it is a single Action running in different modes.

The pull request action has different inputs so it should have its own action.yml. The code could check what action was running and do the appropriate work but it does make it more complex.

Now I understand. And I agree with your reasoning. Thank you for being patient with me.

Eventually, I want to use ncc

The sample is doing this. The outputs are in the same folders as the action.yml.

I totally missed this (I was on my phone, I did not work last week). It looks beautiful.

dscho added a commit that referenced this pull request Feb 8, 2025
…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 <[email protected]>
dscho added a commit that referenced this pull request Mar 4, 2025
…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 <[email protected]>
dscho added a commit that referenced this pull request Aug 15, 2025
…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 <[email protected]>
dscho added a commit that referenced this pull request Aug 16, 2025
…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 <[email protected]>
dscho added a commit that referenced this pull request Aug 16, 2025
…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 <[email protected]>
dscho added a commit to dscho/gitgitgadget that referenced this pull request Aug 16, 2025
…tion

In preparation for a different approach, remove what had been done in
5e0129b (Merge pull request gitgitgadget#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 <[email protected]>
dscho added a commit to dscho/gitgitgadget that referenced this pull request Aug 17, 2025
…tion

In preparation for a different approach, remove what had been done in
5e0129b (Merge pull request gitgitgadget#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 <[email protected]>
dscho added a commit to dscho/gitgitgadget that referenced this pull request Aug 18, 2025
…tion

In preparation for a different approach, remove what had been done in
5e0129b (Merge pull request gitgitgadget#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 <[email protected]>
dscho added a commit to dscho/gitgitgadget that referenced this pull request Aug 18, 2025
…tion

In preparation for a different approach, remove what had been done in
5e0129b (Merge pull request gitgitgadget#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 <[email protected]>
dscho added a commit that referenced this pull request Aug 20, 2025
…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 <[email protected]>
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.

2 participants