Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra] Create first reusable workflow #159

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/reusable-add-reviewers-to-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Add reviewers to PRs

on:
pull_request:
types: ['labeled']
pull_request_target:
branches: ['master', 'next']
michelengelen marked this conversation as resolved.
Show resolved Hide resolved
workflow_call:
inputs:
team-slug:
description: 'The slug of the team from which reviewers get collected'
required: true
type: string
label-name:
description: 'The name of the label that triggers the action'
required: true
type: string
secrets:
token:
description: 'The github token to use for the API calls. You can use the GITHUB_TOKEN secret'
required: true
type: string

permissions: {}

jobs:
add-reviewers-to-pr:
# Tests that label is added on the PR
if: ${{ github.event.label.name == inputs.label-name }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- id: get-members
run: |
DATA=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/${{ github.repository_owner }}/teams/${{ inputs.team-slug }}/members?role=maintainer&per_page=100 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this logic. Is this PR meant to experiment with reusable workflow?

| jq 'reduce inputs as $i (.; . += $i)') \
echo "data=$DATA" >> $GITHUB_OUTPUT

# assign reviewers
- id: assign-reviewers
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{"reviewers":[${{ join(fromJson(steps.get-members.outputs.data).*.login) }}]}' \
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ src
.env.test.local
.env.production.local

# IDE specific files
.idea

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down Expand Up @@ -53,4 +56,4 @@ packages/toolpad-app/public/typings.json
packages/toolpad-app/prisma/generated


.toolpad-generated
.toolpad-generated
85 changes: 0 additions & 85 deletions tools-public/devlake/docker-compose.yml

This file was deleted.

Loading