Skip to content

Assign all collaborators to issues with 'everyone' label #399

Assign all collaborators to issues with 'everyone' label

Assign all collaborators to issues with 'everyone' label #399

name: Assign all collaborators to issues with 'everyone' label
on:
schedule:
- cron: '0 0 * * *' # Every day at midnight
workflow_dispatch:
permissions:
issues: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
fetchCurrentIssuesAndCollaborators:
runs-on: ubuntu-latest
outputs:
issues: ${{ steps.fetch-issues.outputs.issues }}
collaborators: ${{ steps.fetch-collaborators.outputs.collaborators }}
steps:
- uses: actions/checkout@v4
- name: Fetch issues with 'everyone' label
id: fetch-issues
run: |
issues=$(gh api 'repos/${{ github.repository }}/issues?labels=everyone' | jq -c)
echo "issues=$issues" >> $GITHUB_OUTPUT
- name: Fetch collaborators
id: fetch-collaborators
run: |
collaborators=$(gh api repos/${{ github.repository }}/collaborators | jq -c)
echo "collaborators=$collaborators" >> $GITHUB_OUTPUT
assignCollaboratorsToIssues:
needs: fetchCurrentIssuesAndCollaborators
runs-on: ubuntu-latest
strategy:
matrix:
issue: ${{ fromJson(needs.fetchCurrentIssuesAndCollaborators.outputs.issues) }}
collaborator: ${{ fromJson(needs.fetchCurrentIssuesAndCollaborators.outputs.collaborators) }}
max-parallel: 1
steps:
- uses: actions/checkout@v4
- name: Assign collaborator to issue
run: gh issue edit '${{ matrix.issue.number }}' --add-assignee '${{ matrix.collaborator.login }}'