Include user-agent when posting with GitHubPRBot. #2476
Workflow file for this run
This file contains hidden or 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: Post to Phabricator | |
on: | |
pull_request: | |
types: [opened, closed] | |
jobs: | |
post_to_phab: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Post to Phabricator when pull request is opened or closed | |
if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'closed') }} | |
env: | |
PR_BODY: ${{ github.event.pull_request.body }} | |
run: | | |
message="${{ github.actor }} ${{ github.event.action }} ${{ github.event.pull_request._links.html.href }}" | |
echo -e "${PR_BODY}" | grep -oEi "(^Bug:\s*T[0-9]+)|(^([*]*phabricator[*]*:[*]*\s*)?https:\/\/phabricator\.wikimedia\.org\/T[0-9]+)" | grep -oEi "T[0-9]+" | while IFS= read -r line; do | |
echo "Processing: $line" | |
curl --header "User-Agent: GitHubPRBot/1.0 (https://phabricator.wikimedia.org/p/GitHubPRBot)" \ | |
https://phabricator.wikimedia.org/api/maniphest.edit \ | |
-d api.token=${{ secrets.PHAB_BOT_API_KEY }} \ | |
-d transactions[0][type]=comment \ | |
-d transactions[0][value]="${message}" \ | |
-d objectIdentifier=${line} | |
sleep 10 | |
done |