maybe a new issue will have more luck #19
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: Discourse Update | |
on: | |
issues: | |
types: [opened, edited] | |
jobs: | |
update_discourse: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Get Issue Details | |
id: issue_details | |
run: | | |
ISSUE_TITLE="${{ github.event.issue.title }}" | |
ISSUE_BODY="${{ github.event.issue.body }}" | |
ISSUE_AUTHOR="${{ github.event.issue.user.login }}" | |
ISSUE_STATUS="${{ github.event.issue.state }}" | |
- name: Fetch CSRF Token | |
id: csrf_token | |
run: | | |
CSRF_TOKEN=$(curl -s https://goodbids.discourse.group/session/csrf.json | jq -r .csrf) | |
- name: Create JSON Payload | |
id: create_json_payload | |
run: | | |
JSON_DATA="{\"title\": \"test\", \"raw\": \"here is some test content\", \"category\": 22, \"author\": \"jaspercroome\"}" | |
echo "JSON_DATA=${JSON_DATA}" >> $GITHUB_ENV | |
- name: Post Update to Discourse | |
run: | | |
JSON_DATA="${{ env.JSON_DATA }}" | |
CSRF_TOKEN="${{ env.CSRF_TOKEN }}" | |
curl -X POST "https://goodbids.discourse.group/posts.json" \ | |
-H "Content-Type: application/json" \ | |
-H "Api-Key: ${{ secrets.DISCOURSE_UPDATE_SECRET }}" \ | |
-H "Api-Username: jaspercroome" \ | |
-H "X-CSRF-Token: $CSRF_TOKEN" \ | |
-d "${JSON_DATA}" |