{"id":17032943,"url":"https://github.com/up9cloud/action-notify","last_synced_at":"2025-04-12T12:44:19.227Z","repository":{"id":65162155,"uuid":"279786902","full_name":"up9cloud/action-notify","owner":"up9cloud","description":"Send notifications all in one.","archived":false,"fork":false,"pushed_at":"2025-03-23T12:41:37.000Z","size":100,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T07:22:49.897Z","etag":null,"topics":["discord","github-actions","slack","telegram"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/up9cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-15T06:38:18.000Z","updated_at":"2025-03-23T12:40:15.000Z","dependencies_parsed_at":"2023-01-13T15:44:33.130Z","dependency_job_id":null,"html_url":"https://github.com/up9cloud/action-notify","commit_stats":{"total_commits":66,"total_committers":1,"mean_commits":66.0,"dds":0.0,"last_synced_commit":"d94bf29b958c2f74e434acf2189f70cc64579af7"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/up9cloud%2Faction-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/up9cloud%2Faction-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/up9cloud%2Faction-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/up9cloud%2Faction-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/up9cloud","download_url":"https://codeload.github.com/up9cloud/action-notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248570125,"owners_count":21126363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","github-actions","slack","telegram"],"created_at":"2024-10-14T08:31:05.837Z","updated_at":"2025-04-12T12:44:19.220Z","avatar_url":"https://github.com/up9cloud.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# action-notify\n\nSend notifications all in one.\n\n- [x] Telegram: by [telegram-bot-send.sh](https://github.com/up9cloud/telegram-bot-send.sh)\n- Slack\n  - [x] via [Incoming WebHooks](https://api.slack.com/messaging/webhooks) app.\n  - [x] via [chat.postMessage](https://api.slack.com/methods/chat.postMessage) api.\n- Discord\n  - [x] via [Webhooks](https://discord.com/developers/docs/resources/webhook#execute-webhook)\n  - [ ] via [/channels/{channel.id}/messages](https://discord.com/developers/docs/resources/channel#create-message)\n- [ ] Teams\n- [ ] Gitter\n- [x] Line\n- [ ] IRC\n- [ ] Android push notifications\n- [ ] iOS APNs\n- [ ] Facebook\n- [ ] Google Chat\n\n## Usage\n\n\u003e GitHub Action\n\n```yml\n# It won't work on `pull_request`, github won't pass secrets.xxx for the workflow triggered by pull request\non: [push]\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Notify telegram\n        # You could use master version, but it's recommended to use [latest release version](https://github.com/marketplace/actions/action-notify) instead.\n        uses: up9cloud/action-notify@master\n        if: cancelled() == false\n        env:\n          GITHUB_JOB_STATUS: ${{ job.status }}\n          TELEGRAM_BOT_TOKEN: ${{secrets.TELEGRAM_BOT_TOKEN}}\n          TELEGRAM_CHAT_ID: ${{secrets.TELEGRAM_CHAT_ID}}\n  # Or you could use this as standalone job:\n  notify:\n    if: cancelled() == false\n    needs: deploy\n    runs-on: ubuntu-latest\n    steps:\n      - uses: up9cloud/action-notify@master\n        env:\n          GITHUB_JOB_STATUS: ${{ needs.deploy.result }}\n          TELEGRAM_BOT_TOKEN: ${{secrets.TELEGRAM_BOT_TOKEN}}\n          TELEGRAM_CHAT_ID: ${{secrets.TELEGRAM_CHAT_ID}}\n          # Custom template file path, relative to the repo root\n          TELEGRAM_TEMPLATE_PATH: \"./test/telegram/custom.txt\"\n          # Custom env, assign it from [GitHub context](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts)\n          CUSTOM_VAR1: ${{github.repository_owner}}\n          CUSTOM_VAR2: \"a custom variable\"\n```\n\nSee more usage examples: [`.github/workflows/main.yml`](https://github.com/up9cloud/action-notify/blob/master/.github/workflows/main.yml)\n\n\u003e Drone CI\n\n```yml\nkind: pipeline\nname: after\n\nsteps:\n- name: notify\n  image: sstc/action-notify\n  environment:\n    CUSTOM_VAR2: \"a custom variable in environment\"\n  settings:\n    telegram_bot_token:\n      from_secret: telegram_bot_token\n    telegram_chat_id:\n      from_secret: telegram_chat_id\n    custom_var2: \"a custom variable in settings\"\n```\n\n## Custom template\n\nTemplate will be parsed by [envsubst](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html), e.q.\n\n```txt\nCommit message: ${GIT_COMMIT_MESSAGE}\nRepo owner: ${CUSTOM_VAR1}\nCustom var: ${CUSTOM_VAR2}\nCustom var in drone plugin settings: ${PLUGIN_CUSTOM_VAR2}\n```\n\nSee more template examples: `./template/**/*`\n\n## Env variables\n\nYou can:\n\n- Use CI built-in env\n  - GitHub Action: [default environment variables](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables)\n  - Drone CI: pipeline [environment reference](https://docs.drone.io/pipeline/environment/reference/) if you're running Drone CI\n- Customize by yourself, see usage\n- Use following built-in env\n\n### Built-in variables\n\nCommon ones:\n\n- `GITHUB_JOB_STATUS`: **Required if** you're using `GitHub Action`, have to set this to let entrypoint.sh knows job status.\n\n  ```yml\n  env:\n    GITHUB_JOB_STATUS: ${{ job.status }}\n  ```\n\n- `CUSTOM_SCRIPT`: Run custom script, and will **ignore** default action\n  - e.q. if you set this with TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID, it will **only** run your CUSTOM_SCRIPT instead trigger built-in notify_telegram function\n- `VERBOSE`: show log or not, true or false\n  - *Default value*: false\n\nPlatform related:\n\n- `Telegram`\n  - `TELEGRAM_TEMPLATE_PATH`: Telegram template file path\n    - *Default value*: `./template/telegram/${TEMPLATE}.${TELEGRAM_PARSE_MODE}`\n  - `TELEGRAM_TEMPLATE_CONTENT`: Telegram template content. If set, it will ignore the `TELEGRAM_TEMPLATE_PATH`\n  - `TELEGRAM_BOT_TOKEN`: Get it from [@BotFather](https://telegram.me/BotFather)\n    - **Required if** want to notify telegram\n    - e.q. 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\n  - `TELEGRAM_CHAT_ID`: First sending messages to bot, then get it from `https://api.telegram.org/bot\u003ctoken\u003e/getUpdates`\n    - **Required if** want to notify telegram\n    - e.q. -123456789\n  - `TELEGRAM_MESSAGE_THREAD_ID`: The topic ID, obtainable from `/getUpdates` `message_thread_id`\n  - `TELEGRAM_PARSE_MODE`: `txt`, `md` or `html`. This will map to telegram [formatting options](https://core.telegram.org/bots/api#formatting-options)\n    - *Default value*: `txt`\n- `Slack`\n  - `SLACK_TEMPLATE_PATH`: Slack template file path\n    - *Default value*: `./template/slack/${TEMPLATE}.json`\n  - `SLACK_TEMPLATE_CONTENT`: Slack template content. If set, it will ignore the `SLACK_TEMPLATE_PATH`\n  - `SLACK_WEBHOOK_URL`: Get it from `Incoming WebHooks` app\n    - **Required if** want to notify slack via webhook\n    - e.q. `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`\n  - `SLACK_API_TOKEN`: Slack api token, various. If you were using bot token, remember `/invite @BOT_NAME` first\n    - **Required if** want to notify slack via api\n  - `SLACK_CHANNEL`: Slack channel id\n    - **Required if** want to notify slack via api. (good to have if via webhook)\n    - e.q. `#general`\n- `Discord`\n  - `DISCORD_TEMPLATE_PATH`: Discord template file path\n    - *Default value*: `./template/discord/${TEMPLATE}.json`\n  - `DISCORD_TEMPLATE_CONTENT`: Discord template content. If set, it will ignore the `DISCORD_TEMPLATE_PATH`\n  - `DISCORD_WEBHOOK_URL`: Get it from `Edit Channel -\u003e Integrations -\u003e Webhooks`\n    - **Required if** want to notify discord via webhook\n  - `DISCORD_BOT_TOKEN`: Get it from [Developer Applications](https://discord.com/developers/applications) -\u003e `New Application (or choose existing) -\u003e Bot -\u003e Token`. Additionally, you need to add the application (bot) into your server: `https://discord.com/api/oauth2/authorize?client_id=\u003cclient_id\u003e\u0026permissions=0\u0026scope=bot%20applications.commands`. To find the `client_id`, go to [Developer Applications](https://discord.com/developers/applications) -\u003e select the application -\u003e `OAuth2 -\u003e CLIENT ID`. If the channel is private, also need to add the bot to the channel: choose the channel -\u003e `Edit Channel -\u003e Permissions -\u003e Add members or roles`\n    - **Required if** want to notify discord via bot\n  - `DISCORD_CHANNEL_ID`: First, enable Developer Mode [`User Settings -\u003e Advanced -\u003e Developer Mode`], then copy channel ID [`Right mouse click on needed channel -\u003e Copy ID`]. Also, you can find ID in browser app url (e.q. `https://discord.com/channels/.../\u003cchannel id\u003e`)\n    - **Required if** want to notify discord via bot\n- `Line`\n  - `LINE_TEMPLATE_PATH`: Line.me template file path\n    - *Default value*: `./template/line.me/${TEMPLATE}.json`\n  - `LINE_TEMPLATE_CONTENT`: Line.me template content. If set, it will ignore the `LINE_TEMPLATE_PATH`\n  - `LINE_CHANNEL_ACCESS_TOKEN`: Get it from Developer console -\u003e Bot -\u003e `Messaging api -\u003e Channel access token (long-lived)`\n    - **Required if** want to notify line.me\n  - `LINE_TO`: The user id, group id or chat id. Get it from webhook objects (have to build your server to receive objects)\n    - **Required if** want to notify line.me\n    - It can be multiple ids\n      - Must be `user`s, if you want to notify mixed ids with group or chat id, you `have` to trigger this action one by one.\n      - Using `,` to separate each id, e.q.\n\n      ```yml\n      env:\n        LINE_TO: \"Uxxxxxxxxxxx,Uxxxxxxxxxxx\"\n      ```\n\nTemplate related\n\n- `TEMPLATE`: Built in template style, see `./template/\u003cvendor variants\u003e/${TEMPLATE}.\u003cext\u003e`\n  - Could be `debug`, `default` or `default.drone`\n  - *Default value*\n    - GitHub Action: default\n    - Drone CI: default.drone\n- `GIT_SHA_SHORT`: Shorter commit sha `cut -c1-8`\n- `GIT_COMMIT_MESSAGE`\n  - GitHub Action: event's value `.commits[-1].message`, `.workflow_run.head_commit.message`\n  - Drone CI: same as DRONE_COMMIT_MESSAGE\n- `GIT_COMMIT_MESSAGE_ESCAPED`: Same as GIT_COMMIT_MESSAGE, but escaped, can be safely used in JSON template\n  - e.q. `{\"msg\":\"${GIT_COMMIT_MESSAGE_ESCAPED}\"}`\n- `GIT_COMMITTER_USERNAME`\n  - GitHub Action: event's value `.commits[-1].committer.username`, `.workflow_run.head_commit.committer.name`\n  - Drone CI: same as DRONE_COMMIT_AUTHOR\n\n- `STATUS_COLOR`: The RGB color hex code based on job status and following settings:\n  - `STATUS_COLOR_SUCCESS`: The success color\n    - *Default value*: `#22863a`\n  - `STATUS_COLOR_FAILURE`: The failure color\n    - *Default value*: `#cb2431`\n  - `STATUS_COLOR_CANCELLED`: The cancelled color\n    - *Default value*: `#6a737d`\n- `STATUS_COLOR_DECIMAL`: The decimal code of `STATUS_COLOR`\n- `STATUS_EMOJI`: The emoji based on job status and following settings:\n  - `STATUS_EMOJI_SUCCESS`: The success emoji\n    - *Default value*: `🟢`\n  - `STATUS_EMOJI_FAILURE`: The failure emoji\n    - *Default value*: `🔴`\n  - `STATUS_EMOJI_CANCELLED`: The cancelled emoji\n    - *Default value*: `⚪️`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fup9cloud%2Faction-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fup9cloud%2Faction-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fup9cloud%2Faction-notify/lists"}