Update Hugo dependencies #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Hugo Module Dependencies | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" # Run daily at midnight | |
| jobs: | |
| update-dependencies: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.20 # Adjust to your required Go version | |
| - name: Update Hugo module dependencies | |
| run: | | |
| hugo mod get -u ./... | |
| hugo mod tidy | |
| - name: Commit changes | |
| uses: github-actions-x/[email protected] | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| commit_message: "fix: update Hugo module dependencies" | |
| branch: hugo-mod-dependencies # Create a branch for updates | |
| push: true | |
| - name: Create Pull Request | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { data: pullRequest } = await github.pulls.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: "Update Hugo module dependencies", | |
| head: "hugo-mod-dependencies", | |
| base: "main", | |
| body: "This PR updates Hugo module dependencies automatically." | |
| }); | |
| core.info(`Pull request created: ${pullRequest.html_url}`); |