Skip to content

Commit

Permalink
feat: add support for GH enterprise customers (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrandr committed Sep 25, 2023
1 parent db4a30a commit fd1304b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
29 changes: 15 additions & 14 deletions README.md
Expand Up @@ -38,20 +38,21 @@ Since the issues and pull requests from this repository are also managed by this

## Variables

| Variable | Required | Description |
| ------------------------ | -------- |------------ |
| `gh_token` | false | The GitHub token to use for the automation. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_ID` | false | The GitHub App ID used for App authentication. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_installation_ID` | false | The Github App installation ID binding the App to the target org. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_secret_key` | false | The Github App Secret key used to sign App JWT tokens. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `user` | false | The GitHub username that owns the projectboard. Either a user or an organization must be specified. |
| `organization` | false | The GitHub organization that owns the projectboard. Either a user or an organization must be specified. |
| `project_id` | true | The projectboard id. |
| `resource_node_id` | true | The id of the resource node. |
| `status_value` | false | The status value to set. Must be one of the values defined in your project board **Status field settings**. If left unspecified, new items are added without an explicit status, and existing items are left alone. |
| `operation_mode` | false | The operation mode to use. Must be one of `custom_field`, `status`. Defaults to: `status` |
| `custom_field_values` | false | Provides the possibility to change custom fields. To be applied the **operation_mode** must be set to `custom_field`. For the json definition refer to [JSON-Definition](#JSON-Definition) |
| `move_related_issues` | false | If set to `true` and the operation mode is set to `status`, the automation will also move related issues to the same column. This is useful if you want to move an issue to the same column as its related pull request. Defaults to: `false` |
| Variable | Required | Description |
|--------------------------| -------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `gh_host` | false | The GitHub hostname of the enterpise installation to use for the automation. For App instructions refer to [GH App Auth](#GH-App-Auth). |
| `gh_token` | false | The GitHub token to use for the automation. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_ID` | false | The GitHub App ID used for App authentication. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_installation_ID` | false | The Github App installation ID binding the App to the target org. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `gh_app_secret_key` | false | The Github App Secret key used to sign App JWT tokens. For App instructions refer to [GH App Auth](#GH-App-Auth). (`gh_token` or `gh_app_*` must be defined) |
| `user` | false | The GitHub username that owns the projectboard. Either a user or an organization must be specified. |
| `organization` | false | The GitHub organization that owns the projectboard. Either a user or an organization must be specified. |
| `project_id` | true | The projectboard id. |
| `resource_node_id` | true | The id of the resource node. |
| `status_value` | false | The status value to set. Must be one of the values defined in your project board **Status field settings**. If left unspecified, new items are added without an explicit status, and existing items are left alone. |
| `operation_mode` | false | The operation mode to use. Must be one of `custom_field`, `status`. Defaults to: `status` |
| `custom_field_values` | false | Provides the possibility to change custom fields. To be applied the **operation_mode** must be set to `custom_field`. For the json definition refer to [JSON-Definition](#JSON-Definition) |
| `move_related_issues` | false | If set to `true` and the operation mode is set to `status`, the automation will also move related issues to the same column. This is useful if you want to move an issue to the same column as its related pull request. Defaults to: `false` |

## Getting started

Expand Down
8 changes: 6 additions & 2 deletions action.yml
@@ -1,6 +1,10 @@
name: "project beta automations"
description: 'GitHub ProjectV2/Project-Beta automation. It supports management of status and custom fields.'
inputs:
gh_host:
description: 'The hostname will be used by gh-cli. This works for enterprise customers.'
required: false
default: "api.github.com"
gh_token:
description: 'Permission token that grants permission to the GitHub API. (Toke or App config is required)'
required: false
Expand Down Expand Up @@ -79,12 +83,12 @@ runs:
- name: "Authenticate gh cli Github App"
if: inputs.gh_app_secret_key != '' && inputs.gh_app_ID != '' && inputs.gh_app_installation_ID
shell: bash
run: "${{ github.action_path }}/gh_app_credential_helper.sh \"${{ inputs.gh_app_secret_key }}\" \"${{ inputs.gh_app_ID }}\" \"${{ inputs.gh_app_installation_ID }}\" | gh auth login --with-token"
run: "${{ github.action_path }}/gh_app_credential_helper.sh \"${{ inputs.gh_app_secret_key }}\" \"${{ inputs.gh_app_ID }}\" \"${{ inputs.gh_app_installation_ID }}\" | gh auth login --with-token --hostname \"${{ inputs.gh_host }}\""

- name: "Authenticate gh cli PAT"
if: inputs.gh_token != ''
shell: bash
run: echo "${{ inputs.gh_token }}" | gh auth login --with-token
run: echo "${{ inputs.gh_token }}" | gh auth login --with-token --hostname "${{ inputs.gh_host }}"

- name: "Check if User or Organization is set"
if: inputs.organization == '' && inputs.user == ''
Expand Down

0 comments on commit fd1304b

Please sign in to comment.