-
Notifications
You must be signed in to change notification settings - Fork 2
Add S3 upload support for changelogs #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1dd68e0
612c5ee
29dfa9c
1b90a61
757afae
fe7cbe9
01e4908
77acf75
afaed80
d498b6d
6679e98
26fea73
50271a0
ff1df65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Changelog upload | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| config: | ||
| description: 'Path to changelog.yml configuration file' | ||
| type: string | ||
| default: 'docs/changelog.yml' | ||
| pr-number: | ||
| description: 'Pull request number (required for concurrency deduplication)' | ||
| type: string | ||
| required: true | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: changelog-upload-${{ inputs.pr-number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| upload: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Upload changelog | ||
| uses: elastic/docs-actions/changelog/upload@v1 | ||
| with: | ||
| config: ${{ inputs.config }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <!-- Generated by https://github.com/reakaleek/gh-action-readme --> | ||
| # <!--name-->Changelog upload<!--/name--> | ||
| <!--description--> | ||
| Uploads changelog entries for a merged PR to the elastic-docs-v3-changelog-bundles S3 bucket using docs-builder's incremental upload. Only files whose content has changed are transferred. | ||
| <!--/description--> | ||
|
|
||
| ## Inputs | ||
| <!--inputs--> | ||
| | Name | Description | Required | Default | | ||
| |------------------|-------------------------------------------|----------|-----------------------| | ||
| | `config` | Path to changelog.yml configuration file | `false` | `docs/changelog.yml` | | ||
| | `github-token` | GitHub token (used by docs-builder setup) | `false` | `${{ github.token }}` | | ||
| | `aws-account-id` | The AWS account ID | `false` | `197730964718` | | ||
| <!--/inputs--> | ||
|
|
||
| ## Outputs | ||
| <!--outputs--> | ||
| | Name | Description | | ||
| |------|-------------| | ||
| <!--/outputs--> | ||
|
|
||
| ## Usage | ||
| <!--usage action="your/action" version="v1"--> | ||
| <!--/usage--> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Changelog upload | ||
| description: > | ||
| Uploads changelog entries for a merged PR to the elastic-docs-v3-changelog-bundles | ||
| S3 bucket using docs-builder's incremental upload. Only files whose content has | ||
| changed are transferred. | ||
|
|
||
| inputs: | ||
| config: | ||
| description: 'Path to changelog.yml configuration file' | ||
| default: 'docs/changelog.yml' | ||
| github-token: | ||
| description: 'GitHub token (used by docs-builder setup)' | ||
| default: '${{ github.token }}' | ||
| aws-account-id: | ||
| description: 'The AWS account ID' | ||
| default: '197730964718' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Verify event context | ||
| shell: bash | ||
| env: | ||
| MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }} | ||
| run: | | ||
| if [ -z "$MERGE_SHA" ]; then | ||
| echo "::error::merge_commit_sha is empty — must be triggered from a merged pull_request event" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.event.pull_request.merge_commit_sha }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Compare: Add a guard step before the checkout: - name: Verify event context
shell: bash
env:
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
if [ -z "$MERGE_SHA" ]; then
echo "::error::merge_commit_sha is empty — must be triggered from a merged pull_request event"
exit 1
fi |
||
| persist-credentials: false | ||
|
|
||
| - name: Setup docs-builder | ||
| uses: elastic/docs-actions/docs-builder/setup@v1 | ||
| with: | ||
| version: edge | ||
| github-token: ${{ inputs.github-token }} | ||
|
|
||
| - name: Authenticate with AWS | ||
| uses: elastic/docs-actions/aws/auth@v1 | ||
| with: | ||
| aws_account_id: ${{ inputs.aws-account-id }} | ||
| aws_role_name_prefix: elastic-docs-v3-changelog- | ||
|
|
||
| - name: Upload changelogs | ||
| shell: bash | ||
| env: | ||
| CONFIG: ${{ inputs.config }} | ||
| run: | | ||
| docs-builder changelog upload changelog s3 \ | ||
| --s3-bucket-name elastic-docs-v3-changelog-bundles \ | ||
| --config "$CONFIG" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level
permissions: {}. Bothchangelog-validate.yml(line 11) andchangelog-submit.yml(line 15) deny all permissions at the workflow scope and then grant only what each job needs. Without this, the workflow inherits the repository's default token permissions.Add before
jobs::