Updated query to always have an orderBy #40
Workflow file for this run
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
name: Release branch merge actions | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- beta | |
- production | |
jobs: | |
shared-variables: | |
if: github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'no-deploy') | |
runs-on: ubuntu-20.04 | |
outputs: | |
tagname: ${{ steps.tagname.outputs.tagname }} | |
prerelease: ${{ steps.releaseflags.outputs.prerelease }} | |
latestrelease: ${{ steps.releaseflags.outputs.latestrelease }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Generate release tag name (as step output) | |
id: tagname | |
shell: bash | |
run: | | |
echo "tagname=$(bash ci-scripts/parse-release-branch-name.sh ${{ github.event.pull_request.head.ref }})" >> $GITHUB_OUTPUT | |
- name: Fail if variable tagname is empty | |
if: ${{ steps.tagname.outputs.tagname == '' }} | |
shell: bash | |
run: | | |
echo "Github output variable tagname is empty. Failing step." && false | |
- name: Convert base branch to releaseflags (prerelease and latestrelease) | |
id: releaseflags | |
shell: bash | |
run: | | |
echo "prerelease=${{github.event.pull_request.base.ref == 'production' && 'false' || 'true'}}" >> $GITHUB_OUTPUT | |
echo "latestrelease=${{github.event.pull_request.base.ref == 'production' && 'true' || 'false'}}" >> $GITHUB_OUTPUT | |
- name: Fail if prerelease is empty | |
if: ${{ steps.releaseflags.outputs.prerelease == '' }} | |
shell: bash | |
run: | | |
echo "Variable prerelease is empty. Failing step." && false | |
- name: Fail if latestrelease is empty | |
if: ${{ steps.releaseflags.outputs.latestrelease == '' }} | |
shell: bash | |
run: | | |
echo "Variable prerelease is empty. Failing step." && false | |
tag-and-release: | |
runs-on: ubuntu-20.04 | |
needs: [shared-variables] | |
permissions: | |
contents: write | |
env: | |
tagmessage: '' | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Generate and store release message | |
shell: bash | |
run: | | |
{ | |
echo 'tagmessage<<EOF' | |
git log --format=%b -n 1 | |
echo EOF | |
} >> "$GITHUB_ENV" | |
- name: Git tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ needs.shared-variables.outputs.tagname }} | |
message: ${{ env.tagmessage }} | |
- name: Create github release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.shared-variables.outputs.tagname }} | |
name: 'AGR Curation ${{ needs.shared-variables.outputs.tagname }}' | |
prerelease: ${{ needs.shared-variables.outputs.prerelease }} | |
makeLatest: ${{ needs.shared-variables.outputs.latestrelease }} | |
generateReleaseNotes: true | |
skipIfReleaseExists: true | |
token: ${{ secrets.GH_PAT }} | |
open-mergeback-PR-to-alpha: | |
runs-on: ubuntu-20.04 | |
needs: [shared-variables, tag-and-release] | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
mergeback-headbranchname: "gh-actions-mergeback-${{ needs.shared-variables.outputs.tagname }}-alpha" | |
mergeback-basebranchname: "alpha" | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PAT }} | |
- name: create mergeback branch | |
run: | | |
git checkout -b ${{ env.mergeback-headbranchname }} ${{ needs.shared-variables.outputs.tagname }} | |
- name: fetch base branch | |
run: | | |
git fetch origin ${{ env.mergeback-basebranchname }}:${{ env.mergeback-basebranchname }} | |
- name: merge in base branch changes | |
id: merge-base | |
continue-on-error: true | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git merge --no-edit ${{ env.mergeback-basebranchname }} | |
- name: Abort merge if merging in base branch failed | |
if: ${{ steps.merge-base.outcome == 'failure' }} | |
run: | | |
git merge --abort | |
- name: push mergeback branch to github | |
run: | | |
git push origin ${{ env.mergeback-headbranchname }} | |
- name: open PR | |
id: pr-create | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} | |
run: | | |
echo "gh-pr-url=$(gh pr create -B ${{ env.mergeback-basebranchname }} -H ${{ env.mergeback-headbranchname }} \ | |
-t 'Mergeback release ${{ needs.shared-variables.outputs.tagname }} to ${{ env.mergeback-basebranchname }}'\ | |
-b 'Autogenerated through GH-actions.' -a '${{ github.event.pull_request.user.login }}' -l 'no-deploy')" >> $GITHUB_OUTPUT | |
- name: Post notification if automatic merge of base failed | |
if: ${{ steps.merge-base.outcome == 'failure' }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} | |
pr-comment: | | |
GH action detected a potential merge conflict with the base branch (${{ env.mergeback-basebranchname }}). | |
@${{ github.event.pull_request.user.login }} please resolve the merge conflict and merge the base branch manually. | |
run: | | |
gh pr comment ${{ steps.pr-create.outputs.gh-pr-url }} --body "${{ env.pr-comment }}" |