Update openapi.json #1510
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update openapi.json | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- .github/workflows/update-openapi-json.yml | |
branches: [ main ] | |
schedule: | |
- cron: '0 0 * * *' # UTC | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
outputs: | |
changes-count: ${{ steps.changes.outputs.count }} | |
sha: ${{ steps.commit.outputs.sha }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download openapi.json | |
run: | | |
curl --fail --output docs/openapi.v2.json https://api.twitter.com/2/openapi.json | |
- name: Count changes | |
id: changes | |
run: echo "::set-output name=count::$(git diff --name-only | wc -l)" | |
- uses: snow-actions/[email protected] | |
- name: Update openapi.json | |
run: | | |
git add --update | |
git commit -m "Update openapi.json" | |
git push | |
if: steps.changes.outputs.count > 0 | |
- name: SHA | |
id: commit | |
run: echo "::set-output name=sha::$(git log -1 --format='%H')" | |
tweet: | |
runs-on: ubuntu-latest | |
needs: [ update ] | |
if: needs.update.outputs.changes-count > 0 | |
env: | |
CONSUMER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | |
CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_API_KEY_SECRET }} | |
ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
steps: | |
- name: Tweet | |
uses: snow-actions/[email protected] | |
with: | |
status: | | |
Twitter API が更新されました | |
https://snowcait.github.io/twitter-swagger-ui/ | |
差分 | |
https://github.com/SnowCait/twitter-swagger-ui/commit/${{ needs.update.outputs.sha }} |