Skip to content

Add redactionType to sds-go bindings after scanned event (#67) #12

Add redactionType to sds-go bindings after scanned event (#67)

Add redactionType to sds-go bindings after scanned event (#67) #12

Workflow file for this run

name: Create a PR in sds repo to bump the version
on:
push:
branches:
- main
jobs:
trigger:
runs-on: ubuntu-latest
environment: protected
steps:
- name: Extract PR information from github
id: extract-pr-info
run: |
echo "Extracting PR information"
echo "/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls"
res=$(curl -L \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls)
pr_url=`echo $res | jq -r 'if .[0] then .[0].html_url else "UNKNOWN" end'`
author=`echo $res | jq -r 'if .[0] then .[0].user.login else "UNKNOWN" end'`
echo $res
echo $pr_url
echo $author
echo "PR_URL=$pr_url" >> "$GITHUB_OUTPUT"
echo "COMMIT_AUTHOR=$author" >> "$GITHUB_OUTPUT"
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.TRIGGER_APP_ID }}
private-key: ${{ secrets.TRIGGER_GITHUB_APP_PRIVATE_KEY }}
owner: DataDog
repositories: "sds-shared-library"
- name: Trigger Workflow in Another Repository
run: |
# Set the required variables
repo_owner="DataDog"
repo_name="sds-shared-library"
event_type="create_pr"
# Trigger the workflow
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"commit_hash\": \"$GITHUB_SHA\" \
, \"pr_url\": \"${{steps.extract-pr-info.outputs.pr_url}}\" \
, \"commit_author\": \"${{steps.extract-pr-info.outputs.commit_author}}\" \
}}"