Skip to content
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
Expand Down
64 changes: 42 additions & 22 deletions .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#name: "Version Increment"
#
#on:
# # Run this action on any Pull Request raised against ARM
# # pull_request:
# # Ensure changes re-run the version script (i.e. title change)
# types: [opened, edited, synchronize]
# # Don't run on changes to the below paths
# paths-ignore:
# - 'arm_wiki/**'
# - '.github/**'
#
# # Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
on:
pull_request:

permissions:
contents: write
Expand Down Expand Up @@ -51,13 +39,10 @@ jobs:
VERSION_TYPE="minor"
echo "PR set to FEATURE updating minor version"
TITLE_FLAG="true"
elif [[ "$PR_TITLE" == *"[BUGFIX]"* ]]; then
else
VERSION_TYPE="patch"
echo "PR set to BUGFIX updating patch version"
TITLE_FLAG="true"
else
echo "No version bump flag found in PR title. Exiting."
echo "Edit your PR title to include either FEATURE or BUGFIX"
fi

# If Feature or Bugfix update the version
Expand Down Expand Up @@ -93,8 +78,15 @@ jobs:

- name: Comment on PR with no spam
uses: actions/github-script@v8
env:
TITLE_FLAG: ${{ env.TITLE_FLAG }}
PR_TITLE: ${{ env.PR_TITLE }}
NEW_VERSION: ${{ env.NEW_VERSION }}
MAIN_VERSION: ${{ env.MAIN_VERSION }}
BRANCH_VERSION: ${{ env.BRANCH_VERSION }}
VERSION_TYPE: ${{ env.VERSION_TYPE }}
with:
github-token: ${{ secrets.VERSION_BOT }}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Retrieve variables from the environment
const titleFlag = process.env.TITLE_FLAG;
Expand All @@ -108,11 +100,39 @@ jobs:
// Prepare the message based on the title flag
let prBody;
if (titleFlag === "false") {
prBody = `ARM Version Bot\n **PR title:** ${prTitle}\n **No valid version flag found**. PR title must include either [FEATURE] or [BUGFIX] to auto-increment the version.\n **Please update the PR title** and re-run the workflow.`;
prBody = `
### 🚨 ARM Version Bot

**PR Title:** \`${prTitle}\`

> ❌ **No valid version flag found.**
>
> Please include either \`[FEATURE]\` or \`[BUGFIX]\` in your PR title to trigger auto-increment.
>
> _Update the PR title and re-run the workflow._
`;
} else {
prBody = `ARM Version Bot:\n **PR title:** ${prTitle}\n **Current version:** ${currentVersion}\n **Required Version:** ${newVersion}\n **PR Version:** ${branchVersion}\n **Release version:** ${versionType}`;
}
let headerIcon = currentVersion === newVersion ? "✅" : "❌";
let warning = "";
if (currentVersion !== newVersion) {
warning = "> ⚠️ **Warning:** The required version (`" + newVersion + "`) does not match the current version (`" + currentVersion + "`) inside your VERSION file.\n" +
"> This PR will not be merged unless you bump the version number.\n";
}
prBody = `
### ${headerIcon} ARM Version Bot

**PR Title:** \`${prTitle}\`

| Current Version | Required Version | PR Branch Version | Release Type |
| :-------------: | :--------------: | :---------------: | :----------: |
| \`${currentVersion}\` | \`${newVersion}\` | \`${branchVersion}\` | \`${versionType}\` |

${warning}
---
_This comment was generated automatically by the ARM Version Bot._
`;
}

// Get existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
Expand Down