Skip to content

Commit

Permalink
Merge branch 'master' into 29672-block-editor-add-link-doesnt-show-wh…
Browse files Browse the repository at this point in the history
…en-below-on-the-editor
  • Loading branch information
nicobytes authored Sep 20, 2024
2 parents fe786d3 + 8b8dcf6 commit 41912d2
Show file tree
Hide file tree
Showing 219 changed files with 9,669 additions and 2,233 deletions.
32 changes: 32 additions & 0 deletions .github/actions/core-cicd/api-limits-check/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Check GitHub API Rate Limit Action

This GitHub Action allows you to check the current API rate limits for your GitHub account by querying the `/rate_limit` endpoint of the GitHub API. The action outputs the full JSON response, including rate limits for core, search, GraphQL, and other GitHub API resources.

## Inputs

| Input | Description | Required | Default |
|--------|-------------|----------|---------|
| `token` | The GitHub token to authenticate the API request. | true | `${{ github.token }}` |

## Outputs

The action outputs the full JSON response from the `/rate_limit` endpoint directly to the workflow log.

## Usage

Here’s an example of how to use this action in a GitHub workflow:

```yaml
name: Check GitHub API Rate Limits

on:
workflow_dispatch:

jobs:
check-rate-limits:
runs-on: ubuntu-latest
steps:
- name: Check API Rate Limit
uses: your-repo/check-rate-limit-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .github/actions/core-cicd/api-limits-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Check GitHub API Rate Limit'
description: 'Outputs information on GitHub API /rate_limit endpoint'

inputs:
token:
description: 'GitHub token to authenticate the API request'
required: true
default: ${{ github.token }}

runs:
using: "composite"
steps:
- run: |
curl -s -H "Authorization: token ${{ inputs.token }}" https://api.github.com/rate_limit
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ runs:
shell: bash

- name: 'Publishing sdk into NPM registry'
if: ${{ steps.validate_version.outputs.publish == 'true' }}
working-directory: ${{ github.workspace }}/core-web/libs/sdk/
env:
NEXT_VERSION: ${{ steps.next_version.outputs.next_version }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/cicd_comp_finalize-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,12 @@ jobs:
if [ "${{ needs.prepare-report-data.outputs.aggregate_status }}" != "SUCCESS" ]; then
echo "One or more jobs failed or cancelled!"
exit 1
fi
fi
# Check can be removed if we have resolved root cause
# We cannot use a local github action for this as it is run before we checkout the repo
# secrets.GITHUB_TOKEN is not available in composite workflows so it needs to be passed in.
- name: Check API Rate Limit
shell: bash
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/rate_limit || true
20 changes: 16 additions & 4 deletions .github/workflows/cicd_comp_initialize-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ jobs:
shell: bash
run: |
echo "Initializing..."
# Check can be removed if we have resolved root cause
# We cannot use a local github action for this as it is run before we checkout the repo
# secrets.GITHUB_TOKEN is not available in composite workflows so it needs to be passed in.
- name: Check API Rate Limit
shell: bash
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit || true
# This job checks for artifacts from previous builds and determines if they can be reused
check-previous-build:
Expand Down Expand Up @@ -123,17 +130,21 @@ jobs:
steps:
- uses: actions/checkout@v4
if: ${{ inputs.validation-level != 'none' }}

# Execute the paths-filter step to determine changes
- uses: dorny/[email protected]
if: ${{ inputs.validation-level != 'none' }}
id: filter
with:
filters: .github/filters.yaml
list-files: 'escape'

- name: Rewrite Filter
id: filter-rewrite
env:
CICD_SKIP_TESTS: ${{ vars.CICD_SKIP_TESTS }}
run: |
echo "::group::Rewrite Fiter"
# Default action outcomes based on paths-filter action outputs
frontend=${{ steps.filter.outputs.frontend || 'true'}}
cli=${{ steps.filter.outputs.cli || 'true' }}
Expand All @@ -145,7 +156,7 @@ jobs:
# Check if the commit is to the master branch
skip_tests=${CICD_SKIP_TESTS:-false} # Use environment variable, default to 'false'
# The below line ensures that if skip_tests is true, all tests are set to false.
# If skip_tests is true, set all tests to false
if [ "$skip_tests" == "true" ]; then
echo "Skipping tests as per CICD_SKIP_TESTS flag."
frontend=false
Expand All @@ -161,7 +172,7 @@ jobs:
backend=false
build=false
jvm_unit_test=false
sdk_libs=false
IFS=',' read -r -a custom_modules_list <<< "${{ inputs.custom-modules }}"
for module in "${custom_modules_list[@]}"; do
if [ "${module}" == "frontend" ]; then
Expand All @@ -175,7 +186,7 @@ jobs:
elif [ "${module}" == "jvm_unit_test" ]; then
jvm_unit_test=${{ steps.filter.outputs.jvm_unit_test }}
elif [ "${module}" == "sdk_libs" ]; then
sdk=${{ steps.filter.outputs.sdk_libs }}
sdk_libs=${sdk_libs}
fi
done
fi
Expand All @@ -193,4 +204,5 @@ jobs:
echo "backend=${backend}" >> $GITHUB_OUTPUT
echo "build=${build}" >> $GITHUB_OUTPUT
echo "jvm_unit_test=${jvm_unit_test}" >> $GITHUB_OUTPUT
echo "sdk_libs=${sdk_libs}" >> $GITHUB_OUTPUT
echo "sdk_libs=${sdk_libs}" >> $GITHUB_OUTPUT
echo "::endgroup::"
7 changes: 7 additions & 0 deletions .github/workflows/cicd_comp_pr-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ jobs:
-d "{ \"channel\":\"${channel}\",\"text\":\"${message}\"}" \
-s \
https://slack.com/api/chat.postMessage
# Check can be removed if we have resolved root cause
# We cannot use a local github action for this as it is run before we checkout the repo
# secrets.GITHUB_TOKEN is not available in composite workflows so it needs to be passed in.
- name: Check API Rate Limit
shell: bash
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit || true
2 changes: 2 additions & 0 deletions .github/workflows/cicd_comp_test-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ jobs:
- { name: "MainSuite 1b", pathName: "mainsuite1b", maven_args: '-Dit.test=MainSuite1b' }
- { name: "MainSuite 2a", pathName: "mainsuite2a", maven_args: '-Dit.test=MainSuite2a' }
- { name: "MainSuite 2b", pathName: "mainsuite2b", maven_args: '-Dit.test=MainSuite2b' }
- { name: "Junit5 Suite 1", pathName: "junit5suite1", maven_args: '-Dit.test=Junit5Suite1' }

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
104 changes: 92 additions & 12 deletions .github/workflows/cicd_manual_publish-starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,23 @@ jobs:
-H "Authorization: Bearer $ACCESS_TOKEN"
}
mkdir -p starter && cd starter
DATE=$(date +'%Y%m%d')
if [[ "$STARTER_TYPE" == "empty" ]]; then
echo "::debug::Empty Starter: downloading from [${{ env.EMPTY_STARTER_URL }}/${{ env.DOWNLOAD_ENDPOINT }}]"
RESPONSE=$(download_starter ${{ env.EMPTY_STARTER_URL }} ${{ env.EMPTY_STARTER_TOKEN }} empty_$(date +'%Y%m%d').zip)
FILENAME="empty_${DATE}.zip"
RESPONSE=$(download_starter ${{ env.EMPTY_STARTER_URL }} ${{ env.EMPTY_STARTER_TOKEN }} $FILENAME)
else
echo "::debut::Full Starter: downloading from [${{ env.FULL_STARTER_URL }}/${{ env.DOWNLOAD_ENDPOINT }}]"
RESPONSE=$(download_starter ${{ env.FULL_STARTER_URL }} ${{ env.FULL_STARTER_TOKEN }} $(date +'%Y%m%d').zip)
FILENAME="${DATE}.zip"
RESPONSE=$(download_starter ${{ env.FULL_STARTER_URL }} ${{ env.FULL_STARTER_TOKEN }} $FILENAME)
fi
echo "::notice::Status Code: $RESPONSE"
if [[ "$RESPONSE" != "200" ]]; then
echo "::error::Failed with status code: $RESPONSE"
exit 1
fi
ls -ltrh
# echo "::endgroup::"
echo "::endgroup::"
- name: 'Upload artifacts'
id: upload-artifacts
Expand Down Expand Up @@ -149,22 +152,99 @@ jobs:
echo "::notice::Changelog: ${{ github.event.inputs.changelog }}"
echo "::endgroup::"
send-notification:
if: ${{ github.event.inputs.dry-run == 'false' }}
update-pom:
if: ${{ github.event.inputs.type == 'empty' && github.event.inputs.dry-run == false }}
needs: [ deploy-artifacts ]
runs-on: ubuntu-20.04
environment: trunk
outputs:
pull-request-url: ${{ steps.create-pull-request.outputs.pull-request-url }}
steps:
- uses: actions/checkout@v4

- name: 'Update pom.xml'
id: update-pom
working-directory: ${{ github.workspace }}/parent
env:
FILENAME: ${{ needs.deploy-artifacts.outputs.filename }}
run: |
echo "::group::Update pom.xml"
echo "Updating pom.xml"
VERSION="${FILENAME%.*}"
# Create an auxiliary branch for versioning updates
AUXILIARY_BRANCH=update-starter-version-${VERSION}-${{ github.run_id }}
sed -i "s/<starter.deploy.version>.*<\/starter.deploy.version>/<starter.deploy.version>${VERSION}<\/starter.deploy.version>/" pom.xml
POM=$(cat pom.xml)
echo "POM file: ${POM}"
echo auxiliary-branch=${AUXILIARY_BRANCH} >> $GITHUB_OUTPUT
echo starter-version=${VERSION} >> $GITHUB_OUTPUT
echo "::notice::Auxiliary Branch: ${AUXILIARY_BRANCH}"
echo "::endgroup::"
- name: 'Create Pull Request'
id: create-pull-request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CI_MACHINE_TOKEN }}
branch: ${{ steps.update-pom.outputs.auxiliary-branch }}
commit-message: "📦 Publishing an Empty Starter version [${{ steps.update-pom.outputs.starter-version }}]"
title: 'Update starter.deploy.version to [${{ steps.update-pom.outputs.starter-version }}]'
body: >
This PR was created automatically to update the **starter.deploy.version** in pom.xml to [**${{ steps.update-pom.outputs.starter-version }}**].
labels: |
empty-starter
automated pr
send-notification:
needs: [ deploy-artifacts, update-pom ]
runs-on: ubuntu-20.04
environment: trunk
if: always() && github.event.inputs.dry-run == false
steps:

- uses: actions/checkout@v4

- name: Compose Message
id: compose-message
run: |
echo "::group::Compose Message"
ARTIFACT_FILENAME="${{ needs.deploy-artifacts.outputs.filename }}"
ARTIFACT_URL="${{ needs.deploy-artifacts.outputs.url }}"
CHANGELOG="${{ github.event.inputs.changelog }}"
PULL_REQUEST_URL="${{ needs.update-pom.outputs.pull-request-url }}"
if [ "$STARTER_TYPE" == "empty" ]; then
PR_ALERT="> :exclamation:*Approvals required*:exclamation: *PR* ${PULL_REQUEST_URL}"
fi
BASE_MESSAGE=$(cat <<-EOF
> :large_green_circle: *Attention dotters:* a new Starter published!
> This automated script is happy to announce that a new *_${STARTER_TYPE} starter_* :package: \`${ARTIFACT_FILENAME}\` is now available on \`ARTIFACTORY\` :frog:!
>
> :link: ${ARTIFACT_URL}
> *Changelog*
> \`\`\`${CHANGELOG}\`\`\`
>
${PR_ALERT}
EOF
)
MESSAGE="${BASE_MESSAGE}"
echo "Message: ${MESSAGE}"
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "${MESSAGE}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Slack Notification
uses: ./.github/actions/core-cicd/notification/notify-slack
with:
channel-id: "log-starter"
payload: |
> :large_green_circle: *Attention dotters:* a new Starter published!
>
> This automated script is happy to announce that a new *_${{ env.STARTER_TYPE }}_* :package: `${{ needs.deploy-artifacts.outputs.filename }}` is now available on `ARTIFACTORY` :frog:!
> :link:${{ needs.deploy-artifacts.outputs.url }}
> *Changelog*
> ```${{ github.event.inputs.changelog }}```
payload: ${{ steps.compose-message.outputs.message }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}

9 changes: 8 additions & 1 deletion .github/workflows/cicd_post-workflow-reporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,11 @@ jobs:
channel-id: ${{ vars.SLACK_REPORT_CHANNEL }}
payload: ${{ steps.prepare-slack-message.outputs.payload }}
json: true
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
# Check can be removed if we have resolved root cause
# We cannot use a local github action for this as it is run before we checkout the repo
# secrets.GITHUB_TOKEN is not available in composite workflows so it needs to be passed in.
- name: Check API Rate Limit
shell: bash
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit || true
19 changes: 12 additions & 7 deletions .github/workflows/cicd_post_sync-main-with-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: 'Setup git config'
run: |
git config user.name "${{ secrets.CI_MACHINE_USER }}"
git config user.email "[email protected]"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches

- name: 'Setup git config'
run: |
git config user.name "${{ secrets.CI_MACHINE_USER }}"
git config user.email "[email protected]"
- name: Create or update main branch
run: |
# Check if 'main' branch exists
Expand All @@ -35,5 +35,10 @@ jobs:
git checkout -b main origin/master
fi
# Push the updated main branch
git push origin main --force
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.CI_MACHINE_TOKEN }}
branch: main
force: true
tags: true
Loading

0 comments on commit 41912d2

Please sign in to comment.