Merge pull request #4599 from ivan-nejezchleb/ine-lx-57 #30
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
# (C) 2024 GoodData Corporation | |
name: Pull request ~ Prerelease | |
on: | |
push: | |
branches: | |
- master | |
- release | |
jobs: | |
get-pr-from-commit: | |
runs-on: [infra1-small] | |
outputs: | |
should-prerelease: ${{ steps.needs-prerelease.outputs.result }} | |
brach-name: ${{ steps.extract-branch.outputs.branch }} | |
steps: | |
- uses: actions/github-script@v6 | |
id: needs-prerelease | |
with: | |
script: | | |
return ( | |
await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
commit_sha: context.sha, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
).data[0]?.labels?.some((it)=>it.name==='publish pre-release'); | |
result-encoding: string | |
- name: Extract branch name | |
env: | |
CURRENT_REF: ${{ github.event.ref }} | |
id: extract-branch | |
shell: bash | |
run: echo "branch=${CURRENT_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
publish-pre-release: | |
needs: [get-pr-from-commit] | |
name: Publish pre-release | |
if: ${{ needs.get-pr-from-commit.outputs.should-prerelease == 'true' }} | |
uses: ./.github/workflows/rw-publish-prerelase.yml | |
secrets: inherit | |
permissions: | |
contents: write | |
id-token: write | |
with: | |
source-branch: ${{ needs.get-pr-from-commit.outputs.brach-name }} |