netlify-plugin-github-dispatch:部署完成后,与Netlify一起玩以触发GitHub操作

  • m5_429219
    了解作者
  • 772.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-14 03:00
    上传日期
netlify-plugin-github-dispatch 部署完成后,与Netlify一起玩以触发GitHub操作 安装和使用 创建一个具有“回购”权限的。 该令牌将用于触发目标存储库中的工作流程。 提示:描述令牌的用途,以备将来记忆 在“ Netlify部署设置/环境”中将新令牌设置为环境变量 在目标存储库中,添加一个带有workflow_dispatch事件的新工作workflow_dispatch 。 它应该接受两个输入参数,如下所示: # .github/workflows/e2e.yml # test the deployed Netlify site name : e2e on : workflow_dispatch : inputs : siteName : description : Netlify Site Name
netlify-plugin-github-dispatch-main.zip
  • netlify-plugin-github-dispatch-main
  • netlify.toml
    362B
  • .github
  • workflows
  • ci.yml
    570B
  • e2e.yml
    978B
  • public
  • index.html
    57B
  • src
  • dispatch-cli.js
    329B
  • dispatch.js
    1.1KB
  • index.js
    1.8KB
  • images
  • workflow.png
    114.4KB
  • token.png
    191.8KB
  • plugin-message.png
    414.6KB
  • set-token.png
    95.8KB
  • cypress
  • integration
  • spec.js
    269B
  • cypress.json
    78B
  • .prettierrc.json
    86B
  • README.md
    4.2KB
  • manifest.yml
    464B
  • .gitignore
    14B
  • package-lock.json
    266.7KB
  • package.json
    1005B
内容介绍
# netlify-plugin-github-dispatch [![ci status][ci image]][ci url] [![e2e status][e2e image]][ci url] > Playing with Netlify to trigger GitHub Actions after the deploy finishes ## Install and use 1. Create a [new personal GitHub Token](https://github.com/settings/tokens/new) with "repo" permissions. This token will be used to trigger the workflow in the target repository. ![New token](images/token.png) **Tip:** describe the purpose of the token to remember in the future 2. Set the new token as an environment variable in the Netlify Deploy Settings / Environment ![Set token in Netlify deploy settings](images/set-token.png) 3. In the target repository add a new workflow with `workflow_dispatch` event. It should accept two input parameters like this: ```yml # .github/workflows/e2e.yml # test the deployed Netlify site name: e2e on: workflow_dispatch: inputs: siteName: description: Netlify Site Name required: false deployPrimeUrl: description: Deployed URL required: true jobs: show-event: runs-on: ubuntu-20.04 steps: - run: echo "Testing url ${{ github.event.inputs.deployPrimeUrl }}" ``` 4. In the source Netlify repo add this plugin ```toml [[plugins]] package = "netlify-plugin-github-dispatch" [plugins.inputs] owner = "bahmutov" # use the target organization name repo = "ecommerce-netlify" # use the target repo name workflow = ".github/workflows/e2e.yml" # use workflow relative path ``` Push the code and let Netlify deploy ### Expected result If everything works, in the Netlify Deploy log you should see a message from this plugin, something like this: ![Deploy log messages from the plugin](images/plugin-message.png) In the target repository you should see the target workflow executed as if you triggered it manually ![Executed workflow](images/workflow.png) ## Why This plugin is needed because [Netlify does not dispatch `deployment` or `deployment_status` events](https://community.netlify.com/t/can-netlify-deliver-deploy-event-to-github-api-after-successful-deployment/10905) thus we have to do it ourselves via `workflow_dispatch` event. ## Examples - [bahmutov/ecommerce-netlify](https://github.com/bahmutov/ecommerce-netlify) ## Debugging This module uses [debug](https://github.com/visionmedia/debug#readme) to print additional logs. To enable set the environment variable `DEBUG=netlify-plugin-github-dispatch` and run the deploy. ## Small print Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2021 - [@bahmutov](https://twitter.com/bahmutov) - [glebbahmutov.com](https://glebbahmutov.com) - [blog](https://glebbahmutov.com/blog) License: MIT - do anything with the code, but don't blame me if it does not work. Support: if you find any problems with this module, email / tweet / [open issue](https://github.com/bahmutov/netlify-plugin-github-dispatch/issues) on Github ## MIT License Copyright (c) 2021 Gleb Bahmutov <gleb.bahmutov@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [ci image]: https://github.com/bahmutov/netlify-plugin-github-dispatch/workflows/ci/badge.svg?branch=main [e2e image]: https://github.com/bahmutov/netlify-plugin-github-dispatch/workflows/e2e/badge.svg?branch=main [ci url]: https://github.com/bahmutov/netlify-plugin-github-dispatch/actions
评论
    相关推荐
    • github上传
      这是您的模板存储库! 您将在changes分支中进行所有更改。 该存储库已获得 (c)2019 GitHub,Inc.的许可。
    • images:GitHub图像存储
      图片 GitHub图像存储 jsdelivr CDN
    • GitHub
      储存对象 Este proyecto se encarga de manejar losplanes de la liga de la justicia 诺塔斯 小学一年级数学上册期末试卷小学奥数网...
    • 测试github存储
      测试github存储
    • github测试
      github测试 我正在学习如何使用GitHub,这是我的第一个“真实”文件上传。 这组句子是从我的本地存储库创建的。 手指交叉,将其推送到远程仓库。
    • GitHubApp
      GitHubApp 创建具有两个屏幕的应用程序 -屏幕1:应具有您的Github个人资料。 使用响应中的至少4个字段来更新视图。... -屏幕2:使用从您的个人资料获得的存储库填充recyclerView。 每个项目视图中至少要使用3个字段。
    • github-traffic-stats:一个小的Python项目,使用GitHub API提取和存储GitHub项目的流量统计
      一个小型的Python项目,用于使用GitHub API提取和存储GitHub项目的流量统计信息。 目前,GitHub仅向仓库提供14天的流量数据。 该数据包括每天的观看次数和唯一身份访问者人数。 但是,如果您要存储和查看超过14天...
    • github-linkify
      浏览器扩展,显示指向GitHub配置文件和GitHub页面中存储库的链接 GitHub档案和回购链接有时位于最前面,但并非总是如此。 该扩展程序会在您访问GitHub Pages网站时进行检测,并在地址栏中添加指向相应配置文件或...
    • GitHits:永久存储GitHub的流量见解
      一个GitHub动作,用于*永久存储GitHub生成的流量信息,即视图和计数。 * GitHub仅提供14天之内的流量洞察。 此GitHub Action旨在克服该限制。 专为与使用而。 用法 创建/检索具有存储库级别访问权限的个人访问...