Skip to content

Commit c0d0177

Browse files
authored
Add workflow for automatic API updates (#458)
* Add workflow for automatic API updates * Update branch name * Update changelog
1 parent c4e6ea7 commit c0d0177

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/update_api.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update API from slack-api-ref
2+
on:
3+
schedule:
4+
- cron: "15 23 * * *"
5+
jobs:
6+
update-api:
7+
if: ${{ github.repository == 'slack-ruby/slack-ruby-client' }}
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
steps:
13+
# Setup and potential creation of initial pull request
14+
- uses: actions/checkout@v3
15+
with:
16+
submodules: recursive
17+
- name: Get current date
18+
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
19+
- name: Make a file to trigger an initial pull request
20+
run : echo "${{ env.CURRENT_DATE }}" > file.txt
21+
- name: Create initial pull request
22+
id: create-initial-pull-request
23+
uses: peter-evans/create-pull-request@v4
24+
with:
25+
branch: automated-api-update
26+
base: master
27+
# Generation of new API methods and update of pull request
28+
- name: Set up Ruby
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: "3.2"
32+
bundler-cache: true
33+
- name: Update API from slack-api-ref
34+
run: bundle exec rake slack:api:update
35+
- name: Remove files added by setup-ruby
36+
run: rm -rf vendor
37+
- name: Update changelog
38+
run: |
39+
ruby -i -pe 'sub(/\* Your contribution here\./, "* Your contribution here.\n* [#${{ steps.create-initial-pull-request.outputs.pull-request-number }}](https://github.com/slack-ruby/slack-ruby-client/pull/${{ steps.create-initial-pull-request.outputs.pull-request-number }}): Update Slack API (${{ env.CURRENT_DATE }}) - [@slack-ruby-client](https://github.com/slack-ruby/slack-ruby-client).")' CHANGELOG.md
40+
- name: Create pull request with changelog
41+
id: update-changelog
42+
uses: peter-evans/create-pull-request@v4
43+
with:
44+
commit-message: Update API from slack-api-ref (${{ env.CURRENT_DATE }})
45+
title: Update API from slack-api-ref (${{ env.CURRENT_DATE }})
46+
body: |
47+
Update API from [slack-api-ref](https://github.com/slack-ruby/slack-api-ref) (${{ env.CURRENT_DATE }})
48+
branch: automated-api-update
49+
base: master
50+
committer: GitHub <[email protected]>
51+
author: GitHub <[email protected]>

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 2.2.0 (Next)
22

33
* Your contribution here.
4+
* [#458](https://github.com/slack-ruby/slack-ruby-client/pull/458): Add workflow for automatic API updates - [@duffn](https://github.com/duffn).
45
* [#455](https://github.com/slack-ruby/slack-ruby-client/pull/455): Update Slack API: Added pagination to `team.accessLogs` and `AppsDatastore` methods - [@marfoldi](https://github.com/marfoldi).
56
* [#454](https://github.com/slack-ruby/slack-ruby-client/pull/454): Added `Slack::Messages::Formatting#escape` - [@marfoldi](https://github.com/marfoldi).
67
* [#452](https://github.com/slack-ruby/slack-ruby-client/pull/452): Automatically generate Web API multi-argument requirements from docs - [@jmanian](https://github.com/jmanian).

0 commit comments

Comments
 (0)