Skip to content

chore(deps): update adyen/adyen-swift-public-api-diff action to v0.8.4 #47

chore(deps): update adyen/adyen-swift-public-api-diff action to v0.8.4

chore(deps): update adyen/adyen-swift-public-api-diff action to v0.8.4 #47

Workflow file for this run

name: "🚀 Release on merge"
on:
pull_request:
types: [closed]
jobs:
create_release:
if: github.event.pull_request.merged == true
name: "Create Release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Pull Request Details
continue-on-error: true
run: |
SOURCE_BRANCH=${{ github.event.pull_request.head.ref }}
# Checking if the source branch was a release
# If the branch is not a release branch we return early and skip the subsequent steps
if [[ "$SOURCE_BRANCH" != release/* ]]; then
echo "PROCEED=false" >> $GITHUB_ENV
echo "Source branch does not match pattern. Exiting."
echo "IS_RELEASE_BRANCH=false" >> $GITHUB_ENV
exit 0
fi
# Extracting the version number from the source branch name
# If the version number does not match we fail to indicate an issue
VERSION_NUMBER=${SOURCE_BRANCH#release/}
if [[ ! "$VERSION_NUMBER" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "'$VERSION_NUMBER' does not match semantic versioning format. Exiting."
exit 1
fi
echo "IS_RELEASE_BRANCH=true" >> $GITHUB_ENV
MERGE_COMMIT_SHA=${{ github.event.pull_request.merge_commit_sha }}
PR_NUMBER=${{ github.event.pull_request.number }}
echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV
echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV
echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV
# Requesting the PR info
PR_INFO=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER})
# Extracting the PR body from the PR info
PR_BODY=$(jq --raw-output .body <<< "$PR_INFO")
echo "PR Body: $PR_BODY"
echo "$PR_BODY" >> "${{ github.workspace }}/release_content.md"
- name: Create Release
if: env.IS_RELEASE_BRANCH == 'true'
uses: softprops/action-gh-release@v2
with:
body_path: "${{ github.workspace }}/release_content.md"
draft: true
target_commitish: ${{ env.MERGE_COMMIT_SHA }}
tag_name: ${{ env.VERSION_NUMBER }}
token: ${{ secrets.GITHUB_TOKEN }}