Skip to content

Commit

Permalink
Update action.yml
Browse files Browse the repository at this point in the history
ktauchathuranga authored Dec 3, 2024
1 parent 51a9f8f commit 2815750
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -6,25 +6,31 @@ branding:
inputs:
GITHUB_TOKEN:
description: 'GitHub token for API requests.'
required: true # No default value, so the user must provide it
required: true
runs:
using: "composite"
steps:
- name: Checkout PR Code
uses: actions/checkout@v3
shell: bash # Add this line to specify the shell

- name: Get Version from Pull Request
id: pr_version
run: |
pr_version=$(grep '^version=' library.properties | cut -d'=' -f2)
echo "PR version: $pr_version"
echo "pr_version=$pr_version" >> $GITHUB_ENV
shell: bash # Specify shell

- name: Fetch Main Branch Version
run: |
git fetch origin main
git checkout origin/main -- library.properties
main_version=$(grep '^version=' library.properties | cut -d'=' -f2)
echo "Main version: $main_version"
echo "main_version=$main_version" >> $GITHUB_ENV
shell: bash # Specify shell

- name: Compare Versions
id: compare_versions
run: |
@@ -34,6 +40,8 @@ runs:
else
echo "PR version is different from the main branch version."
fi
shell: bash # Specify shell

- name: Merge Pull Request
if: success() && steps.compare_versions.outcome == 'success'
run: |
@@ -46,6 +54,8 @@ runs:
-H "Accept: application/vnd.github.v3+json" \
-d '{"commit_title":"Merge PR #'"${PR_NUMBER}"' - '"${PR_TITLE}"'","merge_method":"squash"}'
echo "Pull request #${PR_NUMBER} merged successfully."
shell: bash # Specify shell

- name: Create GitHub Release
if: success()
uses: actions/create-release@v1
@@ -59,3 +69,4 @@ runs:
prerelease: false
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} # Pass the token provided by the user
shell: bash # Specify shell

0 comments on commit 2815750

Please sign in to comment.