Skip to content

Commit

Permalink
Create activator.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanalgar authored Jan 18, 2024
1 parent fb9d9bd commit 5b38a80
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/activator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: activator

on:
issue_comment:
types:
- created

permissions:
contents: write
pull-requests: write
issues: write

jobs:
activator-ghclient:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '/activator')
container:
image: ghcr.io/jonathanalgar/activator-ghclient:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Add reaction to comment
run: |
COMMENT_ID=${{ github.event.comment.id }}
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"content":"eyes"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/$COMMENT_ID/reactions"
- name: Set ref for checkout
id: set_ref
run: |
PR_API_URL="${{ github.event.issue.pull_request.url }}"
REF=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $PR_API_URL | jq -r .head.ref)
echo "REF=$REF" >> $GITHUB_ENV
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
ref: ${{ env.REF }}

- name: Run script
env:
GITHUB_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number }}
ACTIVATOR_ENDPOINT: ${{ secrets.ACTIVATOR_ENDPOINT }}
ACTIVATOR_TOKEN: ${{ secrets.ACTIVATOR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_ID: ${{ github.event.comment.id }}
run: python /app/activator-ghclient.py

0 comments on commit 5b38a80

Please sign in to comment.