Skip to content

Commit c807912

Browse files
author
Genevieve Nuebel
committed
And some more fixes
1 parent 273ad97 commit c807912

5 files changed

Lines changed: 70 additions & 9 deletions

File tree

.github/workflows/generate.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ jobs:
113113
status: ${{ job.status }}
114114
token: ${{ secrets.GITHUB_TOKEN }}
115115
notification_title: "{repo}: {workflow} workflow"
116-
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
117-
footer: "<{workflow_url}|View Workflow>"
116+
message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>"
118117
notify_when: "failure"
119118
env:
120119
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/on-push-master.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
paths:
77
- 'v20111101/**'
88
- 'v20250224/**'
9+
repository_dispatch:
10+
types: [manual_push_to_master]
911

1012
jobs:
1113
# Check for skip-publish flag in commit message. This allows skipping publish/release for specific scenarios,
@@ -28,9 +30,11 @@ jobs:
2830
echo "✅ No skip flag - proceeding with publish/release"
2931
fi
3032
31-
# Detect which API versions were modified in this push
32-
# Uses dorny/paths-filter to reliably check which directories changed
33-
# This allows us to run publish/release jobs only for versions that were actually modified
33+
# Detect which API versions were modified
34+
# Uses dorny/paths-filter to check which version directories changed.
35+
# For push events: paths-filter uses github.event.before/after automatically.
36+
# For repository_dispatch events: both push and dispatch target master (same branch),
37+
# so we compare HEAD against HEAD~1 to detect changes from the just-pushed commit.
3438
detect-changes:
3539
runs-on: ubuntu-latest
3640
outputs:
@@ -41,6 +45,7 @@ jobs:
4145
- uses: dorny/paths-filter@v2
4246
id: filter
4347
with:
48+
base: ${{ github.event_name == 'repository_dispatch' && 'HEAD~1' || '' }}
4449
filters: |
4550
v20111101:
4651
- 'v20111101/**'
@@ -89,3 +94,22 @@ jobs:
8994
with:
9095
version_directory: v20250224
9196
secrets: inherit
97+
98+
# Notify on failure of orchestration jobs (check-skip-publish, detect-changes, delay).
99+
# Publish and release workflows have their own Slack notifications, so we only
100+
# monitor the jobs owned by this workflow to avoid double-alerting.
101+
slack-notification:
102+
runs-on: ubuntu-latest
103+
needs: [check-skip-publish, detect-changes, delay-for-v20250224]
104+
if: always() && (needs.check-skip-publish.result == 'failure' || needs.detect-changes.result == 'failure' || needs.delay-for-v20250224.result == 'failure')
105+
steps:
106+
- name: Slack notification
107+
uses: ravsamhq/notify-slack-action@v2
108+
with:
109+
status: failure
110+
token: ${{ secrets.GITHUB_TOKEN }}
111+
notification_title: "{repo}: {workflow} workflow"
112+
message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>"
113+
notify_when: "failure"
114+
env:
115+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/openapi-generate-and-push.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,25 @@ jobs:
6363
ruby-version: 3.1
6464
- name: Validate configuration
6565
run: ruby .github/config_validator.rb "${{ matrix.config_file }}" "${{ matrix.api_version }}"
66+
6667
- name: Bump version
6768
id: bump_version
6869
run: |
6970
VERSION="${{ github.event.client_payload.version || 'patch' }}"
7071
NEW_VERSION=$(ruby .github/version.rb $VERSION ${{ matrix.config_file }})
7172
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
73+
7274
- name: Clean repo
7375
run: ruby .github/clean.rb ${{ matrix.api_version }}
76+
7477
- name: Copy generator ignore rules
7578
run: |
7679
mkdir -p ./${{ matrix.api_version }}/
7780
cp .openapi-generator-ignore ./${{ matrix.api_version }}/
81+
7882
- name: Install openapi-generator-cli
7983
run: npm install @openapitools/openapi-generator-cli -g
84+
8085
- name: Generate SDK
8186
run: |
8287
COMMIT_SHA="${{ github.event.client_payload.commit_sha || 'master' }}"
@@ -92,11 +97,13 @@ jobs:
9297
-c ${{ matrix.config_file }} \
9398
-t ./openapi/templates \
9499
-o ./${{ matrix.api_version }}
100+
95101
- name: Upload SDK artifacts
96102
uses: actions/upload-artifact@v4
97103
with:
98104
name: generated-${{ matrix.api_version }}
99105
path: ./${{ matrix.api_version }}
106+
100107
- name: Upload config artifact
101108
uses: actions/upload-artifact@v4
102109
with:
@@ -112,6 +119,7 @@ jobs:
112119
uses: actions/download-artifact@v4
113120
with:
114121
path: ./generated
122+
115123
- name: Restore config files from artifacts
116124
run: |
117125
# Config files are bumped in the Generate job (separate runner).
@@ -126,6 +134,7 @@ jobs:
126134
127135
# Clean up config artifact directories so they don't get committed
128136
rm -rf ./generated/config-*
137+
129138
- name: Move generated files and track versions
130139
id: track_versions
131140
run: |
@@ -144,6 +153,7 @@ jobs:
144153
done
145154
146155
echo "generated_versions=$GENERATED_VERSIONS" >> $GITHUB_OUTPUT
156+
147157
- name: Update CHANGELOG
148158
run: |
149159
GENERATED_VERSIONS="${{ steps.track_versions.outputs.generated_versions }}"
@@ -158,6 +168,7 @@ jobs:
158168
# Trim leading/trailing whitespace first
159169
VERSIONS_CSV=$(echo "$GENERATED_VERSIONS" | xargs | tr ' ' ',')
160170
ruby .github/changelog_manager.rb "$VERSIONS_CSV"
171+
161172
- name: Copy documentation
162173
run: |
163174
GENERATED_VERSIONS="${{ steps.track_versions.outputs.generated_versions }}"
@@ -167,6 +178,7 @@ jobs:
167178
cp CHANGELOG.md "./$VERSION/CHANGELOG.md"
168179
cp MIGRATION.md "./$VERSION/MIGRATION.md"
169180
done
181+
170182
- name: Checkout master
171183
run: git checkout master
172184
- name: Create commit
@@ -181,3 +193,31 @@ jobs:
181193
run: git push origin master
182194
env:
183195
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
196+
197+
# GitHub security feature: pushes using GITHUB_TOKEN don't trigger other workflows.
198+
# We must explicitly trigger on-push-master.yml using a GitHub App token.
199+
- name: Generate access token
200+
id: generate_token
201+
uses: tibdex/github-app-token@v1
202+
with:
203+
app_id: ${{ secrets.PAPI_SDK_APP_ID }}
204+
installation_id: ${{ secrets.PAPI_SDK_INSTALLATION_ID }}
205+
private_key: ${{ secrets.PAPI_SDK_PRIVATE_KEY }}
206+
207+
- name: Trigger publish and release workflow
208+
uses: peter-evans/repository-dispatch@v2
209+
with:
210+
token: ${{ steps.generate_token.outputs.token }}
211+
event-type: manual_push_to_master
212+
213+
- name: Slack notification
214+
uses: ravsamhq/notify-slack-action@v2
215+
if: always()
216+
with:
217+
status: ${{ job.status }}
218+
token: ${{ secrets.GITHUB_TOKEN }}
219+
notification_title: "{repo}: {workflow} workflow"
220+
message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>"
221+
notify_when: "failure"
222+
env:
223+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ jobs:
4040
status: ${{ job.status }}
4141
token: ${{ secrets.GITHUB_TOKEN }}
4242
notification_title: "{repo}: {workflow} workflow"
43-
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
44-
footer: "<{workflow_url}|View Workflow>"
43+
message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>"
4544
notify_when: "failure"
4645
env:
4746
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ jobs:
4242
status: ${{ job.status }}
4343
token: ${{ secrets.GITHUB_TOKEN }}
4444
notification_title: "{repo}: {workflow} workflow"
45-
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
46-
footer: "<{workflow_url}|View Workflow>"
45+
message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>"
4746
notify_when: "failure"
4847
env:
4948
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)