From 97f229526a35b13d471dad4af052afb7e2b0621c Mon Sep 17 00:00:00 2001 From: Yelshat Duskaliyev Date: Mon, 6 Feb 2023 22:00:23 +0300 Subject: [PATCH 1/4] feat: added github action metadata file --- action.yml | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..1ecf4d5 --- /dev/null +++ b/action.yml @@ -0,0 +1,133 @@ +name: "run releaseit" +description: "generates release notes for an application and publishes it to different destinations" +author: "Semior001" +inputs: + # general changelog params + version: + description: "version of releaseit to use in form of v1.2 or v1.2.3 or `latest` to use the latest version" + required: false + from: + description: "commit reference to start generating release notes from" + default: "{{ previous_tag .To }}" + required: false + to: + description: "commit reference to stop generating release notes at" + default: "{{ last_tag }}" + required: false + timeout: + description: "timeout for the generating release notes" + default: "5m" + required: false + squash-commit-rx: + description: "regular expression to match squash commits" + default: "^.*#\d+.*$" + required: false + conf-location: + description: "location of the releaseit configuration file" + default: ".releaseit.yml" + required: false + extras: + description: "extra variables to pass to the template, in format of `key:value,key2:value2`" + required: false + + # github engine params + engine-github-timeout: + description: "timeout for github requests" + default: "5m" + required: false + engine-github-basic-auth-username: + description: "username for github's basic authentication" + required: false + engine-github-basic-auth-password: + description: "password for github's basic authentication" + required: false + + # notifier params + notify-stdout: + description: "whether to print release notes to stdout" + default: "true" + required: false + + # telegram notifier params + notify-telegram-chat-id: + description: "telegram chat id to send release notes to" + required: false + notify-telegram-token: + description: "telegram bot token to send release notes with" + required: false + notify-telegram-web-page-preview: + description: "whether to enable web page preview for telegram messages" + default: "false" + required: false + notify-telegram-timeout: + description: "timeout for telegram requests" + default: "5m" + required: false + + # github release notifier params + notify-github-timeout: + description: "timeout for github requests" + default: "5m" + required: false + notify-github-release-name-tmpl: + description: "template for github release name" + default: "Release {{ .Tag.Name }}" + required: false + notify-github-basic-auth-username: + description: "username for github's basic authentication" + required: false + notify-github-basic-auth-password: + description: "password for github's basic authentication" + required: false + + # mattermost hook notifier params + notify-mattermost-hook-url: + description: "mattermost hook url to send release notes to" + required: false + notify-mattermost-hook-timeout: + description: "timeout for mattermost hook requests" + default: "5m" + required: false + + # post request notifier params + notify-post-url: + description: "url to send release notes to" + required: false + notify-post-timeout: + description: "timeout for post requests" + default: "5m" + required: false + +runs: + using: "docker" + image: "Dockerfile" + env: + FROM: ${{ inputs.from }} + TO: ${{ inputs.to }} + TIMEOUT: ${{ inputs.timeout }} + SQUASH_COMMIT_RX: ${{ inputs.squash-commit-rx }} + CONF_LOCATION: ${{ inputs.conf-location }} + EXTRAS: ${{ inputs.extras }} + ENGINE_TYPE: "github" + ENGINE_GITHUB_TIMEOUT: ${{ inputs.engine-github-timeout }} + ENGINE_GITHUB_REPO_FULL_NAME: ${{ github.repository }} + ENGINE_GITHUB_BASIC_AUTH_USERNAME: ${{ inputs.engine-github-basic-auth-username }} + ENGINE_GITHUB_BASIC_AUTH_PASSWORD: ${{ inputs.engine-github-basic-auth-password }} + NOTIFY_STDOUT: ${{ inputs.notify-stdout }} + NOTIFY_TELEGRAM_CHAT_ID: ${{ inputs.notify-telegram-chat-id }} + NOTIFY_TELEGRAM_TOKEN: ${{ inputs.notify-telegram-token }} + NOTIFY_TELEGRAM_WEB_PAGE_PREVIEW: ${{ inputs.notify-telegram-web-page-preview }} + NOTIFY_TELEGRAM_TIMEOUT: ${{ inputs.notify-telegram-timeout }} + NOTIFY_GITHUB_TIMEOUT: ${{ inputs.notify-github-timeout }} + NOTIFY_GITHUB_RELEASE_NAME_TMPL: ${{ inputs.notify-github-release-name-tmpl }} + NOTIFY_GITHUB_REPO_FULL_NAME: ${{ github.repository }} + NOTIFY_GITHUB_BASIC_AUTH_USERNAME: ${{ inputs.notify-github-basic-auth-username }} + NOTIFY_GITHUB_BASIC_AUTH_PASSWORD: ${{ inputs.notify-github-basic-auth-password }} + NOTIFY_MATTERMOST_HOOK_URL: ${{ inputs.notify-mattermost-hook-url }} + NOTIFY_MATTERMOST_HOOK_TIMEOUT: ${{ inputs.notify-mattermost-hook-timeout }} + NOTIFY_POST_URL: ${{ inputs.notify-post-url }} + NOTIFY_POST_TIMEOUT: ${{ inputs.notify-post-timeout }} + +branding: + icon: "shield" + color: "yellow" \ No newline at end of file From d20c1aca16e8ac2c2e0b79358bcda7b50e1bccc9 Mon Sep 17 00:00:00 2001 From: Yelshat Duskaliyev Date: Mon, 6 Feb 2023 22:34:48 +0300 Subject: [PATCH 2/4] feat: use github actor as default github's basic auth username --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 1ecf4d5..9a78a6d 100644 --- a/action.yml +++ b/action.yml @@ -3,9 +3,6 @@ description: "generates release notes for an application and publishes it to dif author: "Semior001" inputs: # general changelog params - version: - description: "version of releaseit to use in form of v1.2 or v1.2.3 or `latest` to use the latest version" - required: false from: description: "commit reference to start generating release notes from" default: "{{ previous_tag .To }}" @@ -37,6 +34,7 @@ inputs: required: false engine-github-basic-auth-username: description: "username for github's basic authentication" + default: "${{ github.actor }}" required: false engine-github-basic-auth-password: description: "password for github's basic authentication" @@ -75,6 +73,7 @@ inputs: required: false notify-github-basic-auth-username: description: "username for github's basic authentication" + default: "${{ github.actor }}" required: false notify-github-basic-auth-password: description: "password for github's basic authentication" From 6422f59b4db948a7c0724d236044c51f5eeeb72a Mon Sep 17 00:00:00 2001 From: Yelshat Duskaliyev Date: Mon, 6 Feb 2023 22:42:12 +0300 Subject: [PATCH 3/4] feat: remove default regexp (default value is provided in tool itself) --- action.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/action.yml b/action.yml index 9a78a6d..2fb312b 100644 --- a/action.yml +++ b/action.yml @@ -5,19 +5,15 @@ inputs: # general changelog params from: description: "commit reference to start generating release notes from" - default: "{{ previous_tag .To }}" required: false to: description: "commit reference to stop generating release notes at" - default: "{{ last_tag }}" required: false timeout: description: "timeout for the generating release notes" - default: "5m" required: false squash-commit-rx: description: "regular expression to match squash commits" - default: "^.*#\d+.*$" required: false conf-location: description: "location of the releaseit configuration file" @@ -30,7 +26,6 @@ inputs: # github engine params engine-github-timeout: description: "timeout for github requests" - default: "5m" required: false engine-github-basic-auth-username: description: "username for github's basic authentication" @@ -55,17 +50,14 @@ inputs: required: false notify-telegram-web-page-preview: description: "whether to enable web page preview for telegram messages" - default: "false" required: false notify-telegram-timeout: description: "timeout for telegram requests" - default: "5m" required: false # github release notifier params notify-github-timeout: description: "timeout for github requests" - default: "5m" required: false notify-github-release-name-tmpl: description: "template for github release name" @@ -85,7 +77,6 @@ inputs: required: false notify-mattermost-hook-timeout: description: "timeout for mattermost hook requests" - default: "5m" required: false # post request notifier params @@ -94,7 +85,6 @@ inputs: required: false notify-post-timeout: description: "timeout for post requests" - default: "5m" required: false runs: From 4c2b1eadee6e546e6274c82d463343217b7d8636 Mon Sep 17 00:00:00 2001 From: Yelshat Duskaliyev Date: Mon, 6 Feb 2023 22:47:13 +0300 Subject: [PATCH 4/4] feat: set repository full name as input --- action.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 2fb312b..5f2250c 100644 --- a/action.yml +++ b/action.yml @@ -29,7 +29,7 @@ inputs: required: false engine-github-basic-auth-username: description: "username for github's basic authentication" - default: "${{ github.actor }}" + default: ${{ github.actor }} required: false engine-github-basic-auth-password: description: "password for github's basic authentication" @@ -65,7 +65,7 @@ inputs: required: false notify-github-basic-auth-username: description: "username for github's basic authentication" - default: "${{ github.actor }}" + default: ${{ github.actor }} required: false notify-github-basic-auth-password: description: "password for github's basic authentication" @@ -87,6 +87,16 @@ inputs: description: "timeout for post requests" required: false + # repository parameters, usually shouldn't be changed + engine-github-repo-full-name: + description: "full name of the repository to generate release notes for" + default: ${{ github.repository }} + required: false + notify-github-repo-full-name: + description: "full name of the repository to send release notes to" + default: ${{ github.repository }} + required: false + runs: using: "docker" image: "Dockerfile" @@ -99,7 +109,7 @@ runs: EXTRAS: ${{ inputs.extras }} ENGINE_TYPE: "github" ENGINE_GITHUB_TIMEOUT: ${{ inputs.engine-github-timeout }} - ENGINE_GITHUB_REPO_FULL_NAME: ${{ github.repository }} + ENGINE_GITHUB_REPO_FULL_NAME: ${{ inputs.engine-github-repo-full-name }} ENGINE_GITHUB_BASIC_AUTH_USERNAME: ${{ inputs.engine-github-basic-auth-username }} ENGINE_GITHUB_BASIC_AUTH_PASSWORD: ${{ inputs.engine-github-basic-auth-password }} NOTIFY_STDOUT: ${{ inputs.notify-stdout }} @@ -109,7 +119,7 @@ runs: NOTIFY_TELEGRAM_TIMEOUT: ${{ inputs.notify-telegram-timeout }} NOTIFY_GITHUB_TIMEOUT: ${{ inputs.notify-github-timeout }} NOTIFY_GITHUB_RELEASE_NAME_TMPL: ${{ inputs.notify-github-release-name-tmpl }} - NOTIFY_GITHUB_REPO_FULL_NAME: ${{ github.repository }} + NOTIFY_GITHUB_REPO_FULL_NAME: ${{ inputs.notify-github-repo-full-name }} NOTIFY_GITHUB_BASIC_AUTH_USERNAME: ${{ inputs.notify-github-basic-auth-username }} NOTIFY_GITHUB_BASIC_AUTH_PASSWORD: ${{ inputs.notify-github-basic-auth-password }} NOTIFY_MATTERMOST_HOOK_URL: ${{ inputs.notify-mattermost-hook-url }}