Read more button styling #7
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: Github to Teamwork link | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened] | |
| env: | |
| GH_TO_TW_API_KEY: ${{ secrets.GH_TO_TW_API_KEY }} | |
| GH_TO_TW_API_PWD: ${{ secrets.GH_TO_TW_API_PWD }} | |
| GH_TO_TW_SECRET: ${{ secrets.GH_TO_TW_SECRET }} | |
| jobs: | |
| parse-description: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract info and call API | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const description = context.payload.pull_request.body || ""; | |
| const urlMatch = description.match(/##\s*Issue\s*\n(https?:\/\/\S+)/i); | |
| if (urlMatch) { | |
| const teamworkUrl = urlMatch[1]; | |
| const body = JSON.stringify({ | |
| "taskUrl": teamworkUrl, | |
| "githubUrl": context.payload.pull_request.html_url | |
| }); | |
| const headers = { | |
| "Content-Type": "application/json", | |
| "x-gh2tw-auth": process.env.GH_TO_TW_SECRET, | |
| }; | |
| const response = await fetch( | |
| "https://gh-to-tw-links.indigotree.workers.dev", | |
| { | |
| method: "POST", | |
| headers, | |
| body, | |
| } | |
| ); | |
| const result = await response.json(); | |
| console.log("API response:", result); | |
| } else { | |
| console.log("No issue URL found in PR description."); | |
| } |