-
Notifications
You must be signed in to change notification settings - Fork 6
86 lines (77 loc) · 3.41 KB
/
import.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 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 <devrel@box.com>'
committer: 'Box DevRel <devrel@box.com>'
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/action-slack@2.0.2
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"