|
| 1 | +# The name used in the GitHub UI for the workflow |
| 2 | +name: "update dependabot.yml" |
| 3 | +# When to run this action: |
| 4 | +# - Scheduled to run at 5 AM every Monday. |
| 5 | +# - Manually runnable from the GitHub UI with a reason |
| 6 | +on: |
| 7 | + schedule: |
| 8 | + - cron: "0 5 * * 1" # 5 AM every Monday. |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + reason: |
| 12 | + description: "The reason for running the workflow" |
| 13 | + required: true |
| 14 | + default: "Manual run" |
| 15 | +# Run on the latest version of Ubuntu |
| 16 | +jobs: |
| 17 | + dependabot-bot: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: write |
| 21 | + pull-requests: write |
| 22 | + |
| 23 | + # Checkout the repo into the workspace within the VM |
| 24 | + steps: |
| 25 | + |
| 26 | + # - name: Setup .NET |
| 27 | + # uses: actions/setup-dotnet@4d4a70f4a5b2a5a5329f13be4ac933f2c9206ac0 |
| 28 | + # with: |
| 29 | + # dotnet-version: 7.0.x |
| 30 | + # dotnet-quality: 'preview' |
| 31 | + # If triggered manually, print the reason why |
| 32 | + - name: "Print manual run reason" |
| 33 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 34 | + run: | |
| 35 | + echo "Reason: ${{ github.event.inputs.reason }}" |
| 36 | + # Run the .NET dependabot-bot tool |
| 37 | + - name: dependabot-bot |
| 38 | + id: dependabot-bot |
| 39 | + uses: dotnet/docs-tools/actions/dependabot-bot@main |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + with: |
| 43 | + root-directory: "/github/workspace" |
| 44 | + dependabot-yml-path: ".github/dependabot.yml" |
| 45 | + - name: Create pull request |
| 46 | + if: github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' |
| 47 | + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 |
| 48 | + with: |
| 49 | + branch: create-dependabotconfig-pull-request/patch |
| 50 | + title: "Update dependabot.yml - automatically." |
| 51 | + body: ".NET dependabot-bot automated PR. 🤖" |
| 52 | + commit-message: ".NET dependabot-bot automated PR." |
0 commit comments