Syncing issue #174 #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Issue Sync | |
run-name: "Syncing issue #${{ github.event.issue.number }}" | |
on: | |
issues: | |
types: [opened, edited, closed] | |
issue_comment: | |
types: [created] | |
jobs: | |
build-and-deploy: | |
permissions: | |
id-token: write | |
contents: read | |
issues: read | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup dependencies | |
run: | | |
pip install -r .github/scripts/requirements.txt | |
sudo apt-get install -y httpie | |
- name: Run python script | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FULL_NAME: ${{ github.event.repository.full_name }} | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
run: | | |
python .github/scripts/issue_data.py "$FULL_NAME" "$ISSUE_NUMBER" | |
echo "COMMENTS=$(cat issue_data.json | jq -r '.unique_comments')" >> $GITHUB_ENV | |
echo "REACTIONS=$(cat issue_data.json | jq -r '.unique_reactions')" >> $GITHUB_ENV | |
echo "MENTIONS=$(cat issue_data.json | jq -r '.mentions')" >> $GITHUB_ENV | |
- name: Azure login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Download Certificate | |
uses: azure/cli@v2 | |
env: | |
CERTIFICATE_SECRET_ID: ${{ secrets.CERTIFICATE_SECRET_ID }} | |
with: | |
azcliversion: latest | |
inlineScript: | | |
az keyvault secret download --id "$CERTIFICATE_SECRET_ID" --file client.pem | |
- name: Call endpoint | |
env: | |
PAYLOAD_URL: ${{ secrets.ISSUE_PAYLOAD_URL }} | |
ISSUE_URL: ${{ github.event.issue.html_url }} | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
STATE: ${{ github.event.issue.state }} | |
EVENT_NAME: ${{ github.event_name }} | |
EVENT_ACTION: ${{ github.event.action }} | |
run: | | |
http --ignore-stdin --cert=client.pem --verbose "$PAYLOAD_URL" \ | |
issue_url="$ISSUE_URL" \ | |
issue_number:="$ISSUE_NUMBER" \ | |
state="$STATE" \ | |
comments:="$COMMENTS" \ | |
reactions:="$REACTIONS" \ | |
mentions:="$MENTIONS" \ | |
event_name="$EVENT_NAME" \ | |
event_action="$EVENT_ACTION" |