Do not block graphql_transport_ws
operations while creating context or validating a single request operation
#7563
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 file check | |
on: | |
pull_request_target: | |
types: [synchronize, reopened, opened, ready_for_review] | |
branches: | |
- main | |
paths: | |
- "strawberry/**" | |
- "pyproject.toml" | |
jobs: | |
get-contributor-info: | |
name: Get PR info | |
runs-on: ubuntu-latest | |
outputs: | |
contributor-name: ${{ steps.get-info.outputs.contributor-name }} | |
contributor-username: ${{ steps.get-info.outputs.contributor-username }} | |
contributor-twitter-username: ${{ steps.get-info.outputs.contributor-twitter-username }} | |
steps: | |
- name: Get PR info | |
id: get-info | |
uses: strawberry-graphql/get-pr-info-action@v6 | |
- run: echo "${{ steps.get-info.outputs.contributor-twitter-username }}" | |
skip-if-bot: | |
name: Set skip if PR is from a bot | |
runs-on: ubuntu-latest | |
needs: get-contributor-info | |
outputs: | |
skip: ${{ steps.skip.outputs.skip }} | |
steps: | |
- name: Set skip to true if contributor is a bot | |
id: skip | |
shell: python | |
run: | | |
bots = [ | |
"dependabot-preview[bot]", | |
"dependabot-preview", | |
"dependabot", | |
"dependabot[bot]", | |
] | |
username = "${{ needs.get-contributor-info.outputs.contributor-username }}" | |
if username in bots: | |
print(f"Skipping {username} because it is a bot") | |
print("::set-output name=skip::true") | |
else: | |
print("::set-output name=skip::false") | |
release-file-check: | |
name: Release check | |
runs-on: ubuntu-latest | |
needs: skip-if-bot | |
if: needs.skip-if-bot.outputs.skip == 'false' | |
outputs: | |
changelog: ${{ steps.release-check.outputs.changelog }} | |
status: ${{ steps.release-check.outputs.release_status }} | |
change_type: ${{ steps.release-check.outputs.change_type }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: "refs/pull/${{ github.event.number }}/merge" | |
- name: Release file check | |
uses: ./.github/release-check-action | |
id: release-check | |
if: github.event.pull_request.draft == false | |
read-tweet-md: | |
name: Read TWEET.md | |
runs-on: ubuntu-latest | |
needs: [get-contributor-info, release-file-check] | |
outputs: | |
tweet: ${{ steps.extract.outputs.tweet }} | |
card-text: ${{ steps.extract.outputs.card-text }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: "refs/pull/${{ github.event.number }}/merge" | |
- name: Extract tweet message and changelog | |
id: extract | |
uses: strawberry-graphql/tweet-actions/read-tweet@v4 | |
with: | |
changelog: ${{ needs.release-file-check.outputs.changelog }} | |
version: "(next)" | |
contributor_name: ${{ needs.get-contributor-info.outputs.contributor-name }} | |
contributor_twitter_username: ${{ needs.get-contributor-info.outputs.contributor-twitter-username }} | |
validate-tweet: | |
runs-on: ubuntu-latest | |
needs: read-tweet-md | |
if: ${{ needs.read-tweet-md.outputs.tweet != '' }} | |
steps: | |
- name: Validate tweet | |
uses: strawberry-graphql/tweet-actions/validate-tweet@v4 | |
with: | |
tweet: ${{ needs.read-tweet-md.outputs.tweet }} | |
generate-preview: | |
runs-on: ubuntu-latest | |
needs: [release-file-check, read-tweet-md, get-contributor-info] | |
if: github.event.pull_request.draft == false | |
outputs: | |
url: ${{ steps.upload.outputs.url }} | |
steps: | |
- name: Generate Twitter card preview | |
uses: strawberry-graphql/release-cards@main | |
if: ${{ needs.release-file-check.outputs.status == 'OK' }} | |
with: | |
version: "(next)" | |
contributor: ${{ needs.get-contributor-info.outputs.contributor-name }} | |
description_base64: ${{ needs.read-tweet-md.outputs.card-text }} | |
- name: Uploads preview | |
id: upload | |
if: ${{ needs.release-file-check.outputs.status == 'OK' }} | |
run: | | |
echo ::set-output name=url::$(curl --location --request POST "https://api.imgur.com/3/image" \ | |
--fail \ | |
--header "Authorization: Client-ID $IMGUR_CLIENT_ID" \ | |
--form "image=@screenshot.png;filename=screenshot.png;type=image/png" \ | |
| jq --raw-output '.data.link') | |
env: | |
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} | |
send-comment: | |
runs-on: ubuntu-latest | |
needs: [release-file-check, generate-preview, read-tweet-md] | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Send comment | |
uses: ./.github/bot-action | |
env: | |
BOT_API_URL: ${{ secrets.BOT_API_URL }} | |
API_SECRET: ${{ secrets.API_SECRET }} | |
with: | |
pr_number: ${{ github.event.number }} | |
status: ${{ needs.release-file-check.outputs.status }} | |
change_type: ${{ needs.release-file-check.outputs.change_type }} | |
changelog_base64: ${{ needs.release-file-check.outputs.changelog }} | |
release_card_url: ${{ needs.generate-preview.outputs.url }} | |
tweet: ${{ needs.read-tweet-md.outputs.tweet }} | |
fail-if-status-is-not-ok: | |
runs-on: ubuntu-latest | |
needs: [release-file-check, send-comment] | |
steps: | |
- name: Fail if status is not ok | |
if: ${{ needs.release-file-check.outputs.status != 'OK' }} | |
run: exit 1 |