name: "Update news on owasp-juice.shop"

on:
  release:
    types: [ published ]

jobs:
  UpdateNewsOnWebsite:
    runs-on: ubuntu-latest
    steps:
    - name: Check out Git repository
      uses: actions/checkout@v2
      with:
        token: ${{ secrets.BOT_TOKEN }}
        repository: OWASP/www-project-juice-shop
        branch: master
    - name: 'Update tab_news.md'
      run: |
        sed -i 's/<!-- next:juice-shop -->/<!-- next:juice-shop -->\n* ${{ github.event.published_at }}: juice-shop [`${{ github.ref }}`](https:\/\/github.com\/bkimminich\/juice-shop\/releases\/tag\/${{ github.ref }})/' tab_news.md
    - uses: stefanzweifel/git-auto-commit-action@v4.0.0
      with:
        commit_message: "Add ${{ github.ref }} release notes to tab_news.md"
        branch: master
        commit_options: '--signoff'

        # Optional commit user and author settings
        commit_user_name: JuiceShopBot
        commit_user_email: 61591748+JuiceShopBot@users.noreply.github.com
        commit_author: JuiceShopBot <61591748+JuiceShopBot@users.noreply.github.com>

name: "Update news on owasp-juice.shop"

on:
  release:
    types: [ published ]

jobs:
  UpdateNewsOnWebsite:
    runs-on: ubuntu-latest
    steps:
    - name: Check out Git repository
      uses: actions/checkout@v2
      with:
        token: ${{ secrets.BOT_TOKEN }}
        repository: OWASP/www-project-juice-shop
        branch: master
    - name: 'Update tab_news.md'
      run: |
        sed -i 's/<!-- next:juice-shop -->/<!-- next:juice-shop -->\n* ${{ github.event.release.published_at }}: juice-shop [`${{ github.event.release.tag_name }}`](https:\/\/github.com\/bkimminich\/juice-shop\/releases\/tag\/${{ github.event.release.tag_name }})/' tab_news.md
    - uses: stefanzweifel/git-auto-commit-action@v4.0.0
      with:
        commit_message: "Add juice-shop ${{ github.event.release.tag_name }} release notes to tab_news.md"
        branch: master
        commit_options: '--signoff'

        # Optional commit user and author settings
        commit_user_name: JuiceShopBot
        commit_user_email: 61591748+JuiceShopBot@users.noreply.github.com
        commit_author: JuiceShopBot <61591748+JuiceShopBot@users.noreply.github.com>

Replace reference with tag name from event
Replace reference with tag name from event

(to avoid `sed` command failing from slashes in ref)
