-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
name: Create Release Branch | ||
|
||
on: | ||
schedule: | ||
# Run every Friday at 11:30 AM UTC (5:00 PM IST) | ||
- cron: '30 11 * * FRI' | ||
|
||
jobs: | ||
create-release-branch: | ||
runs-on: ubuntu-latest | ||
|
@@ -11,26 +13,31 @@ jobs: | |
uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
|
||
- name: Get Release Branch Name | ||
run: | | ||
echo "release_branch=xero_api_release_$(date +%Y_%m_%d)" >> $GITHUB_ENV | ||
echo "last_release_branch=xero_api_release_$(date -d 'last friday' +%Y_%m_%d)" >> $GITHUB_ENV | ||
- name: Check if release branch exists | ||
run: | | ||
if git ls-remote --exit-code --heads origin ${{env.release_branch}}; then | ||
echo "branch_exists=true" >> $GITHUB_ENV | ||
else | ||
echo "branch_exists=false" >> $GITHUB_ENV | ||
fi | ||
- name: Create release branch | ||
if: ${{env.branch_exists == 'false'}} | ||
run: | | ||
git checkout -b ${{env.release_branch}} | ||
git push origin ${{env.release_branch}} | ||
echo "message=Branch `${{env.release_branch}}` created successfully." >> $GITHUB_ENV | ||
- name: Branch already exists | ||
if: ${{env.branch_exists == 'true'}} | ||
run: echo "message=Branch `${{env.release_branch}}` already exists." >> $GITHUB_ENV | ||
|
||
- name: Send message on Slack | ||
uses: archive/[email protected] | ||
id: notify | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters