Skip to content

new-release-note

new-release-note #238

Workflow file for this run

# This workflow listens to the `new-release-note`
# dispatch notification, and kicks off the import
# of the release note entry for the repository and
# and version provided in the dispatch notification
# payload.
#
# It then creates a new pull request, which should is
# then automerged with the `automerge` workflow once the
# linting in the `ci` workflow passes.
name: Import Releases
on:
# Only trigger for this notification
repository_dispatch:
types:
- new-release-note
jobs:
import:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Check out the latest version of the code
- name: Check out the repo
uses: actions/checkout@v2
with:
# always use the main branch. This allows us to re-reun
# a failed import with new code
ref: main
# Split the payload ref so we can parse the tag ID
- uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.event.client_payload.ref }}
seperator: "/"
# Use Node to fetch the latest release and store it as a new file
- name: Fetch the new release note
env:
# The tag of the new release
TAG: ${{ steps.split.outputs._2 }}
# The name of the repository (e.g. box/box-node-sdk)
REPOSITORY: ${{ github.event.client_payload.repository }}
# The access token used to authenticate to the GH API
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# A list of labels to add to the markdown frontmatter
LABELS: ${{ github.event.client_payload.labels }}
# The name of the repository to use as a template for the title of the
# entry
REPO_DISPLAY_NAME: ${{ github.event.client_payload.repo_display_name }}
run: |
yarn install
yarn import:release
# Create a PR with the new content
- name: Create a new Pull Request
uses: peter-evans/create-pull-request@v3
with:
# Use a personal access token from box-devrel
# This allows for other workflows to be triggered by this PR
token: ${{ secrets.DISPATCH_ACCESS_TOKEN }}
# Specify the body, title, and commit message for this PR.
commit-message: '@${{github.event.client_payload.repository}} ${{steps.split.outputs._2}} release note'
title: '@${{github.event.client_payload.repository}} ${{steps.split.outputs._2}} release note'
body: 'Automated pull request for @${{github.event.client_payload.repository}} ${{steps.split.outputs._2}} release note'
# Base the branch name off the repo name and tag
branch: "${{github.event.client_payload.repository}}/${{steps.split.outputs._2}}"
# Make the commit appear to come from box-devrel
author: 'Box DevRel <[email protected]>'
committer: 'Box DevRel <[email protected]>'
team-reviewers: 'changelog-reviewers'
# Send a slack notification to notify our team that a new release has been
# received.
- name: Send Slack notification
uses: Ilshidur/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Developer Changelog: @${{ github.event.client_payload.repository }} ${{steps.split.outputs._2}} released"