-
Notifications
You must be signed in to change notification settings - Fork 89
127 lines (113 loc) · 3.83 KB
/
Copy pathci.yml
File metadata and controls
127 lines (113 loc) · 3.83 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# The name of this GH action
name: CI
# Defines when this action should be run
on:
# Run on any Push
push:
branches-ignore:
- en
- en-staging
- en-snapshot
- jp
- jp-partial
# Run for PRs on main and staging
pull_request:
branches: [ main, staging ]
jobs:
# The lint job checks that all content is sanitized,
# spell checked, and without any obvious dead links
lint:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
timeout-minutes: 10
# The following steps are performed for each lint job
steps:
- name: Check out the repository
uses: actions/checkout@v4
# The deploy task actually deploys any changes to the en branch
push-to-en:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
timeout-minutes: 10
# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Push API specification
uses: s0/git-publish-subdir-action@v2.6.0
env:
REPO: self
BRANCH: en
FOLDER: openapi
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify other repositories of update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: box/box-postman
event-type: openapi-update
client-payload: "{}"
- name: Send Slack using Slack GHA notification
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "Pushed latest OpenAPI changes to `en` branch :rocket:",
"icon_url": "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4",
"username": "GitHub Actions"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
- name: Send Slack using Slack GHA notification
uses: slackapi/slack-github-action@v1.27.0
if: ${{ failure() }}
with:
payload: |
{
"text": "Error running `deploy` job in OpenAPI CI",
"icon_url": "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4",
"username": "GitHub Actions"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
# The deploy task actually deploys any changes to the en-staging branch
push-to-en-staging:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging'
timeout-minutes: 10
# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Push API specification
uses: s0/git-publish-subdir-action@v2.6.0
env:
REPO: self
BRANCH: staging
FOLDER: openapi
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send Slack using Slack GHA notification
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "Pushed latest OpenAPI changes to `en-staging` branch :rocket:",
"icon_url": "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4",
"username": "GitHub Actions"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
- name: Send Slack using Slack GHA notification
uses: slackapi/slack-github-action@v1.27.0
if: ${{ failure() }}
with:
payload: |
{
"text": "Error running `deploy-staging` job in OpenAPI CI",
"icon_url": "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4",
"username": "GitHub Actions"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}