From 51874d286f9c759d4b5e0f09eb675d41b4ce1c30 Mon Sep 17 00:00:00 2001 From: "K.Takata" Date: Thu, 3 Feb 2022 15:18:04 +0900 Subject: [PATCH 1/2] Avoid GHA workflow being automatically stopped Add an empty commit to the master branch once a month. See #22 --- .github/workflows/trigger.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/trigger.yml diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml new file mode 100644 index 00000000..cdde10fc --- /dev/null +++ b/.github/workflows/trigger.yml @@ -0,0 +1,17 @@ +name: Trigger new build +on: + schedule: + - cron: '15 11 3 * *' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: checkout master + uses: actions/checkout@v2 + - name: Create an empty commit and push it + run: | + git config --local user.name 'github-actions' + git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' + git commit --allow-empty -m 'Trigger a new build' + git push origin master From 8dd17863fdb6e306b68ea723dc0bc2e213ce620c Mon Sep 17 00:00:00 2001 From: "K.Takata" Date: Thu, 3 Feb 2022 15:57:47 +0900 Subject: [PATCH 2/2] Use API to enable each workflow Idea by @thinca. --- .github/workflows/trigger.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml index cdde10fc..93fd69ad 100644 --- a/.github/workflows/trigger.yml +++ b/.github/workflows/trigger.yml @@ -1,4 +1,4 @@ -name: Trigger new build +name: Enable each workflow on: schedule: - cron: '15 11 3 * *' @@ -7,11 +7,13 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: checkout master - uses: actions/checkout@v2 - - name: Create an empty commit and push it + - name: Enable each workflow run: | - git config --local user.name 'github-actions' - git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' - git commit --allow-empty -m 'Trigger a new build' - git push origin master + curl -i -X PUT \ + -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H "Accept: application/vnd.github.v3+json" \ + 'https://api.github.com/repos/vim-jp/vimdoc-en/actions/workflows/generate.yml/enable' + curl -i -X PUT \ + -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H "Accept: application/vnd.github.v3+json" \ + 'https://api.github.com/repos/vim-jp/vimdoc-en/actions/workflows/trigger.yml/enable'