Bump drupal/antibot from 2.0.3 to 2.0.4 #9040
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
on: | |
pull_request: | |
types: [ opened, synchronize, reopened, closed, edited ] | |
name: Lagoon integration | |
env: | |
LAGOON_ENVIRONMENT: "pr-${{github.event.number}}" | |
GH_TOKEN: ${{ secrets.GH_DEPLOYMENT_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
jobs: | |
BranchNameLength: | |
name: Check branch length | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Ensure branch name length | |
uses: lekterable/[email protected] | |
if: github.ref_type == 'branch' || github.ref_type == 'pull_request' | |
with: | |
allowed: | | |
/^.{1,100}$/ | |
errorMessage: 'Branch name too long. This cannot be deployed to Lagoon.' | |
# Creating the deployment that Lagoon will look for, and add status to. | |
CreateDeployment: | |
name: Create deployment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }} | |
needs: [BranchNameLength] | |
steps: | |
- run: | | |
LAGOON_DEPLOYS_LOG_URL=$(echo "https://ui.lagoon.dplplat01.dpl.reload.dk/projects/dpl-cms/dpl-cms-${{ env.LAGOON_ENVIRONMENT }}/deployments") | |
DEPLOYMENT_ID=$(echo '{ | |
"ref": "${{ github.head_ref || github.ref_name }}", | |
"environment": "${{ env.LAGOON_ENVIRONMENT }}", | |
"auto_merge": false, | |
"required_contexts": [] | |
}' | gh api --method POST "/repos/${{ env.OWNER }}/${{ env.REPO }}/deployments" --input - --jq '.id') | |
gh api --method POST "/repos/${{ env.OWNER }}/${{ env.REPO }}/deployments/$DEPLOYMENT_ID/statuses" \ | |
-f "state=in_progress" -f "log_url=$LAGOON_DEPLOYS_LOG_URL" | |
echo "deployment_id=$DEPLOYMENT_ID" >> $GITHUB_OUTPUT | |
# When we close the pull request, we want to set the environment as inactive. | |
CloseEnvironment: | |
name: Close environment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action == 'closed' }} | |
needs: [BranchNameLength] | |
steps: | |
- run: gh api --method DELETE "/repos/${{ env.OWNER }}/${{ env.REPO }}/environments/${{ env.LAGOON_ENVIRONMENT }}" | |
# We only permit the integration with Lagoon to run if the user is | |
# authorized. This saves on resources and ensures we only spin up sites for | |
# legitimate contributions. | |
# The integration is controlled by creating synthetic events related to select | |
# pull-request events, and send them to Lagoon. | |
InformLagoon: | |
name: Send synthetic event to Lagoon | |
runs-on: ubuntu-latest | |
needs: [BranchNameLength] | |
steps: | |
- name: Send pull request event | |
uses: distributhor/workflow-webhook@v3 | |
env: | |
webhook_url: ${{ secrets.LAGOON_WEBHOOK_URL }} | |
webhook_secret: ${{ secrets.LAGOON_WEBHOOK_SECRET }} | |
webhook_type: 'json-extended' |