Skip to content
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

Release Label creation automation #3660

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/os-increment-plugin-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,36 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
- name: Check if label exists
id: check_label
uses: actions/github-script@v6
with:
github-token: ${{ steps.github_app_token.outputs.token }}
result-encoding: string
script: |
const { data: labels } = await github.rest.issues.listLabelsForRepo({
owner: context.repo.owner,
repo: "${{ matrix.entry.repo }}",
per_page: 100
});
const labelFound = labels.some(label => label.name === 'v${{ env.OPENSEARCH_VERSION_NUMBER }}');
console.log(labelFound);
return labelFound
prudhvigodithi marked this conversation as resolved.
Show resolved Hide resolved
- name: Create label
if: ${{ steps.check_label.outputs.result != 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ steps.github_app_token.outputs.token }}
script: |
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
const newLabel = {
owner: context.repo.owner,
repo: "${{ matrix.entry.repo }}",
name: "v${{ env.OPENSEARCH_VERSION_NUMBER }}",
color: randomColor,
description: "v${{ env.OPENSEARCH_VERSION_NUMBER }}"
};
await github.rest.issues.createLabel(newLabel);
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
Expand All @@ -99,6 +129,8 @@ jobs:
delete-branch: true
branch: create-pull-request/${{ env.OPENSEARCH_VERSION }}
title: '[AUTO] Increment version to ${{ env.OPENSEARCH_VERSION }}'
labels: |
v${{ env.OPENSEARCH_VERSION_NUMBER }}
body: |
- Incremented version to **${{ env.OPENSEARCH_VERSION }}**.
- name: Check outputs
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/osd-increment-plugin-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- name: Bootstrap and Version Increment
run: |
DASHBOARD_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').version")
echo "DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
cd OpenSearch-Dashboards/plugins/${{ matrix.entry.repo }}
if [ ${{ matrix.entry.path }} ]; then
yarn osd bootstrap
Expand Down Expand Up @@ -101,6 +102,36 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
- name: Check if label exists
id: check_label
uses: actions/github-script@v6
with:
github-token: ${{ steps.github_app_token.outputs.token }}
result-encoding: string
script: |
const { data: labels } = await github.rest.issues.listLabelsForRepo({
owner: context.repo.owner,
repo: "${{ matrix.entry.repo }}",
per_page: 100
});
const labelFound = labels.some(label => label.name === 'v${{ env.DASHBOARD_VERSION }}');
console.log(labelFound);
return labelFound
- name: Create label
if: ${{ steps.check_label.outputs.result != 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ steps.github_app_token.outputs.token }}
script: |
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
const newLabel = {
owner: context.repo.owner,
repo: "${{ matrix.entry.repo }}",
name: "v${{ env.DASHBOARD_VERSION }}",
color: randomColor,
description: "v${{ env.DASHBOARD_VERSION }}"
};
await github.rest.issues.createLabel(newLabel);
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
Expand All @@ -115,6 +146,8 @@ jobs:
delete-branch: true
branch: create-pull-request/${{ env.OSD_PLUGIN_VERSION }}
title: '[AUTO] Increment version to ${{ env.OSD_PLUGIN_VERSION }}'
labels: |
v${{ env.DASHBOARD_VERSION }}
body: |
- Incremented version to **${{ env.OSD_PLUGIN_VERSION }}**.
path: 'OpenSearch-Dashboards/plugins/${{ matrix.entry.repo }}'
Expand Down