Skip to content

Commit

Permalink
[Dependencies] - Update .github/workflows/approve-dependabot.yml to m…
Browse files Browse the repository at this point in the history
…atch the template repo
  • Loading branch information
credfeto committed Jan 23, 2024
1 parent 17d581c commit ee60def
Showing 1 changed file with 55 additions and 4 deletions.
59 changes: 55 additions & 4 deletions .github/workflows/approve-dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Dependabot: Approve actions updates in template repos"
name: "Dependabot: Approve updates"
on:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests
# could and should work, at least for public repos;
Expand All @@ -15,7 +15,7 @@ on:
- main

jobs:
enable-auto-merge:
enable-auto-merge-github-actions:
if: |-
vars.DEPENDABOT_AUTOMERGE == 'true' &&
startsWith(github.head_ref, 'dependabot/github_actions/')
Expand All @@ -42,9 +42,36 @@ jobs:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}
merge-method: "MERGE"

auto_approve_dependabot:
enable-auto-merge-npm:
if: |-
endsWith(github.repository, '-template') &&
vars.DEPENDABOT_AUTOMERGE == 'true' &&
startsWith(github.head_ref, 'dependabot/npm_and_yarn/')
runs-on: [self-hosted, linux]

permissions:
contents: write
pull-requests: write

# Specifically check that dependabot (or another trusted party) created this pull-request, and that it has been labelled correctly.

steps:
- name: "Initialise Workspace"
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Check Repo Owner"
uses: actions/[email protected]
with:
script: |
core.info('Owner: ${{github.repository_owner}}');
- name: "Auto Merge"
uses: alexwilson/[email protected]
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}
merge-method: "MERGE"

auto_approve_gitub_actions:
if: |-
vars.DEPENDABOT_AUTOMERGE == 'true' &&
startsWith(github.head_ref, 'dependabot/github_actions/')
runs-on: [self-hosted, linux]

Expand All @@ -65,3 +92,27 @@ jobs:
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}

auto_approve_gitub_npm:
if: |-
vars.DEPENDABOT_AUTOMERGE == 'true' &&
startsWith(github.head_ref, 'dependabot/github_actions/')
runs-on: [self-hosted, linux]

permissions:
contents: write
pull-requests: write

steps:
- name: "Initialise Workspace"
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Check Repo Owner"
uses: actions/[email protected]
with:
script: |
core.info('Owner: ${{github.repository_owner}}');
- name: "Approve"
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}

0 comments on commit ee60def

Please sign in to comment.