Skip to content

Commit

Permalink
Merge pull request akto-api-security#394 from solankirishav21/beamer-…
Browse files Browse the repository at this point in the history
…workflow

fixed beamer workflow
  • Loading branch information
ankush-jain-akto committed Jun 29, 2023
2 parents 02e3e30 + 7af6ff1 commit ed371cf
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions .github/workflows/beamer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,58 @@ jobs:
url = f'https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest'
response = requests.get(url, headers=headers)
data = response.json()
tag_name = data.get('tag_name')
description = data.get('body')
description_lines = description.split('\\n') if description else []
description_lines = description.split('\n') if description else []
description_lines = [line.strip() for line in description_lines if line.strip()]
release_notes = '<ul>'
if description_lines:
first_line = description_lines[0].lstrip('#').strip()
release_notes += f'<h3>{first_line}</h3>'
for line in description_lines[1:-1]: # Exclude the last line
release_notes += f'<li>{line[1:]}</li>'
release_notes += '</ul>'
release_notes2 = '<p>More...</p>'
release_notes2 += '<ul></ul>'
release_notes2 += '<p>'
release_notes2 += '<a href=https://discord.com/invite/Wpc6xVME4s >'
release_notes2 += '</a>'
release_notes2 += '</p>'
release_notes2 += '<ul>'
release_notes2 += '<a href=https://discord.com/invite/Wpc6xVME4s ></a>'
release_notes2 += '<li><a href=https://discord.com/invite/Wpc6xVME4s ></a><a href=https://discord.com/invite/Wpc6xVME4s >Join Discord </a>to know more</li>'
release_notes2 += '<li>Star Akto on <a href=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/akto-api-security/akto>Github</a></li>'
release_notes2 += '</ul>'
release_notes = release_notes+release_notes2

print(f"::set-output name=tag_name::{tag_name}")
print(f"::set-output name=description_lines::{description_lines}")
print(f"::set-output name=release_notes::{release_notes}")
EOF
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Print Tag Name and Description
run: |
echo "Tag Name: ${{ steps.get_latest_release.outputs.tag_name }}"
echo "Description: |"
for line in ${{ steps.get_latest_release.outputs.description_lines }}; do
echo " $line"
done
echo "Description: ${{ steps.get_latest_release.outputs.release_notes }}"
- name: Push Release Notes to Beamer
env:
BEAMER_API_TOKEN: ${{ secrets.BEAMER_API_KEY }}
RELEASE_TAG: ${{ steps.get_latest_release.outputs.tag_name }}
RELEASE_NOTES: |
${{ join(steps.get_latest_release.outputs.description_lines, '\n') }}
RELEASE_NOTES: ${{ steps.get_latest_release.outputs.release_notes}}
run: |
# Push release notes to Beamer
IFS=$'\n'
for line in $RELEASE_NOTES; do
curl --request POST \
--url https://api.getbeamer.com/v0/posts \
--header "Content-Type: application/json" \
--header "Beamer-Api-Key: $BEAMER_API_TOKEN" \
--data "{
\"title\": [ \"New Release: $RELEASE_TAG\" ],
\"content\": [ \"$line\" ],
\"category\": \"new\",
\"publish\": true
}"
done
curl --request POST \
--url https://api.getbeamer.com/v0/posts \
--header "Content-Type: application/json" \
--header "Beamer-Api-Key: $BEAMER_API_TOKEN" \
--data "{
\"title\": [ \"Release $RELEASE_TAG\" ],
\"content\": [ \"$RELEASE_NOTES\" ],
\"category\": \"new\",
\"publish\": true
}"

0 comments on commit ed371cf

Please sign in to comment.