diff --git a/.github/workflows/bump-flake-lock-and-selfup.yml b/.github/workflows/bump-flake-lock-and-selfup.yml new file mode 100644 index 0000000..799e246 --- /dev/null +++ b/.github/workflows/bump-flake-lock-and-selfup.yml @@ -0,0 +1,25 @@ +name: Bump flake.lock and related dependencies +on: + pull_request: + paths: + - '.github/workflows/bump-flake-lock-and-selfup.yml' + schedule: + # At 10:17 JST on day-of-month 1 and on Monday. + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + - cron: '17 1 1 * 1' + workflow_dispatch: + +jobs: + bump: + uses: kachick/selfup/.github/workflows/reusable-bump-flake-lock-and-selfup.yml@action-v1 + if: (github.event.sender.login == 'kachick') || (github.event_name != 'pull_request') + with: + dry-run: ${{ github.event_name == 'pull_request' }} + optional-run: | + nix develop --command bash -c 'node --version | tr -d v' > .node-version + # https://stackoverflow.com/q/34807971 + git update-index -q --really-refresh + git diff-index --quiet HEAD || git commit -m 'Update .node-version' .node-version + secrets: + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b122433..bf59b77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version: '20.8.0' # selfup { "regex": "\\d[^']+", "script": "node --version | tr -d v" } + node-version-file: '.node-version' cache: npm - run: npm ci --ignore-scripts - run: npm run build @@ -39,7 +39,7 @@ jobs: submodules: recursive - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version: '20.8.0' # selfup { "regex": "\\d[^']+", "script": "node --version | tr -d v" } + node-version-file: '.node-version' cache: npm - run: npm ci --ignore-scripts - run: npm test @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version: '20.8.0' # selfup { "regex": "\\d[^']+", "script": "node --version | tr -d v" } + node-version-file: '.node-version' cache: npm - run: npm ci --ignore-scripts - name: Typecheck diff --git a/.github/workflows/merge-bot-pr.yml b/.github/workflows/merge-bot-pr.yml index abaece6..23510e8 100644 --- a/.github/workflows/merge-bot-pr.yml +++ b/.github/workflows/merge-bot-pr.yml @@ -25,3 +25,18 @@ jobs: env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + # https://github.com/kachick/anylang-template/issues/51 + selfup-runner: + timeout-minutes: 30 + runs-on: ubuntu-latest + if: ${{ github.actor == 'selfup-runner[bot]' }} + steps: + - name: Wait other jobs + uses: kachick/wait-other-jobs@v2 + timeout-minutes: 20 + - name: Approve and merge + run: gh pr review --approve "$PR_URL" && gh pr merge --auto --delete-branch --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}