运行 GitHub 停电后如何操作?
how to run GitHub Action after outage?
您可能(或可能不知道)昨天是 GitHub 服务的重大事件:https://www.githubstatus.com/incidents/tyc8wpsgr2r8。
不幸的是,我在那段时间发布了一个版本,负责构建和发布代码的操作没有触发。
对于至少执行一次的操作,我可以选择“重新运行 工作流程”——但我如何才能继续执行一个甚至没有触发的操作——我在任何地方都看不到它什么?
我认为最后的办法是再发布一个版本,删除有问题的版本等等,但我想避免这种情况。
工作流文件:
name: Node.js CI
on:
push:
branches: [master]
release:
types: [published]
pull_request:
branches: [master]
jobs:
test:
name: Test Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install --production=false --no-package-lock
- name: Lint
run: npm run lint
- run: npm test
release:
name: Publish NPM Package
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm install --production=false --no-package-lock
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
gh-pages:
name: Publish GitHub Pages
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
needs:
- test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Install ✔️
run: npm install --production=false --no-package-lock
- name: Build storybook ️
run: npm run build-storybook
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
branch: gh-pages
folder: storybook-static
正如您在评论中所说,最简单的解决方案是删除版本并重新创建它。
另一种选择是使用 tag
输入向工作流添加 workflow_dispatch
事件触发器,更新工作条件以在通知时使用此 input.tag
变量。
这样,如果自动触发失败(通过推送、释放或 pull_request),您可以通过 Github UI 或 GH CLI 作为替代。
您可能(或可能不知道)昨天是 GitHub 服务的重大事件:https://www.githubstatus.com/incidents/tyc8wpsgr2r8。
不幸的是,我在那段时间发布了一个版本,负责构建和发布代码的操作没有触发。
对于至少执行一次的操作,我可以选择“重新运行 工作流程”——但我如何才能继续执行一个甚至没有触发的操作——我在任何地方都看不到它什么?
我认为最后的办法是再发布一个版本,删除有问题的版本等等,但我想避免这种情况。
工作流文件:
name: Node.js CI
on:
push:
branches: [master]
release:
types: [published]
pull_request:
branches: [master]
jobs:
test:
name: Test Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install --production=false --no-package-lock
- name: Lint
run: npm run lint
- run: npm test
release:
name: Publish NPM Package
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm install --production=false --no-package-lock
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
gh-pages:
name: Publish GitHub Pages
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
needs:
- test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Install ✔️
run: npm install --production=false --no-package-lock
- name: Build storybook ️
run: npm run build-storybook
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
branch: gh-pages
folder: storybook-static
正如您在评论中所说,最简单的解决方案是删除版本并重新创建它。
另一种选择是使用 tag
输入向工作流添加 workflow_dispatch
事件触发器,更新工作条件以在通知时使用此 input.tag
变量。
这样,如果自动触发失败(通过推送、释放或 pull_request),您可以通过 Github UI 或 GH CLI 作为替代。