From d2a0fd14e05ef6b0b9fca454f8996faf86f94204 Mon Sep 17 00:00:00 2001 From: Anoduck <9925396+anoduck@users.noreply.github.com> Date: Sun, 8 Sep 2024 14:54:54 +0000 Subject: Initial commit --- .github/workflows/mod-update.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/mod-update.yml (limited to '.github/workflows/mod-update.yml') diff --git a/.github/workflows/mod-update.yml b/.github/workflows/mod-update.yml new file mode 100644 index 0000000..9c12b22 --- /dev/null +++ b/.github/workflows/mod-update.yml @@ -0,0 +1,61 @@ +name: Update Hugo dependencies +on: + workflow_dispatch: + schedule: + - cron: '0 3 * * *' # run daily at 03:00 AM + +permissions: + contents: write + pull-requests: write + +jobs: + update-mod: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + + # [26/AUG/23] Adjusted from npm ci to prevent EBADPLATFORM error due to fsevents + - name: Install npm + run: npm i + + - name: Update Hugo module dependencies + id: mod-updates + run: | + MOD_OUTPUT=$(npm run mod:update 2>&1) + echo "$MOD_OUTPUT" + MOD_UPDATES=$(echo "$MOD_OUTPUT" | grep '^go: upgraded' | sed 's/go: / - /' | sort -u) + echo 'MOD_UPDATES<> $GITHUB_OUTPUT + echo "$MOD_UPDATES" >> "$GITHUB_OUTPUT" + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: gethinode/create-pull-request@v6 + with: + token: ${{ secrets.HUGO_MOD_PR }} + commit-message: 'fix: update Hugo module dependencies' + committer: GitHub + branch: hugo-mod-dependencies + delete-branch: true + title: 'Update Hugo module dependencies' + body: | + This PR is auto-generated by [create-pull-request][1]. + + Changes to go.mod: + + ${{ steps.mod-updates.outputs.MOD_UPDATES }} + + [1]: https://github.com/peter-evans/create-pull-request + labels: dependencies + add-paths: | + go.mod + go.sum + # add **/go.mod **/go.sum if your repository contains any modules in a subfolder -- cgit v1.2.3