approve-contributor workflow

This commit is contained in:
Mitchell Hashimoto
2026-02-03 09:01:41 -08:00
parent 045c540f05
commit dce6552801
3 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
name: Approve Contributor
on:
issue_comment:
types: [created]
jobs:
approve:
if: ${{ !github.event.issue.pull_request }}
runs-on: namespace-profile-ghostty-xsm
permissions:
contents: write
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- uses: DeterminateSystems/nix-installer-action@main
with:
determinate: true
- uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # v16
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Add contributor to approved list
id: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
status=$(nix develop -c nu .github/scripts/approve-contributor.nu \
-R ${{ github.repository }} \
${{ github.event.issue.number }} \
${{ github.event.comment.id }} \
--dry-run=false \
| tail -1)
echo "status=$status" >> "$GITHUB_OUTPUT"
- name: Commit and push
if: steps.update.outputs.status == 'added'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/APPROVED_CONTRIBUTORS
git diff --staged --quiet || git commit -m "chore: approve contributor ${{ github.event.issue.user.login }}"
git push
- name: Comment on issue
if: steps.update.outputs.status == 'added'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} \
--body "@${{ github.event.issue.user.login }} has been added to the approved contributors list. You can now submit PRs. Thanks for contributing!"