Skip to content

Change cron of smm and cap jobs to four times a day #4130

Change cron of smm and cap jobs to four times a day

Change cron of smm and cap jobs to four times a day #4130

name: 'CI/CD pull request'
on:
pull_request:
types: [opened, reopened, synchronize, labeled]
jobs:
metadata:
name: 'Set CI/CD metadata'
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
build_datetime_london: ${{ steps.variables.outputs.build_datetime_london }}
build_datetime: ${{ steps.variables.outputs.build_datetime }}
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
build_epoch: ${{ steps.variables.outputs.build_epoch }}
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
python_version: ${{ steps.variables.outputs.python_version }}
terraform_version: ${{ steps.variables.outputs.terraform_version }}
version: ${{ steps.variables.outputs.version }}
steps:
- name: 'Checkout code'
uses: actions/checkout@v6
- name: 'Set CI/CD variables'
id: variables
run: |
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
echo "build_datetime_london=$(TZ=Europe/London date --date=$datetime +'%Y-%m-%dT%H:%M:%S%z')" >> $GITHUB_OUTPUT
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
echo "nodejs_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "python_version=$(grep "^python" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "terraform_version=$(grep "^terraform" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF}" >> $GITHUB_OUTPUT
commit-stage:
name: 'Commit stage'
needs: [metadata]
uses: ./.github/workflows/stage-1-commit.yaml
with:
build_datetime: '${{ needs.metadata.outputs.build_datetime }}'
build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}'
build_epoch: '${{ needs.metadata.outputs.build_epoch }}'
nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}'
python_version: '${{ needs.metadata.outputs.python_version }}'
terraform_version: '${{ needs.metadata.outputs.terraform_version }}'
version: '${{ needs.metadata.outputs.version }}'
secrets: inherit
test-stage:
name: 'Test stage'
needs: [metadata]
uses: ./.github/workflows/stage-2-test.yaml
with:
build_datetime: '${{ needs.metadata.outputs.build_datetime }}'
build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}'
build_epoch: '${{ needs.metadata.outputs.build_epoch }}'
nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}'
python_version: '${{ needs.metadata.outputs.python_version }}'
terraform_version: '${{ needs.metadata.outputs.terraform_version }}'
version: '${{ needs.metadata.outputs.version }}'
secrets: inherit
build-stage:
name: 'Build stage'
needs: [metadata]
uses: ./.github/workflows/stage-3-build.yaml
with:
build_datetime: '${{ needs.metadata.outputs.build_datetime }}'
build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}'
build_epoch: '${{ needs.metadata.outputs.build_epoch }}'
nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}'
python_version: '${{ needs.metadata.outputs.python_version }}'
terraform_version: '${{ needs.metadata.outputs.terraform_version }}'
version: '${{ needs.metadata.outputs.version }}'
commit_sha: '${{ github.event.pull_request.head.sha }}'
secrets: inherit
deploy-stage:
if: contains(github.event.pull_request.labels.*.name, 'deploy')
name: Deploy review app pr-${{ github.event.pull_request.number }}
needs: [build-stage]
permissions:
id-token: write
uses: ./.github/workflows/stage-4-deploy.yaml
with:
environments: '["review"]'
commit_sha: ${{ github.event.pull_request.head.sha }}
pr_number: ${{ github.event.pull_request.number }}
secrets: inherit
post-url:
if: contains(github.event.pull_request.labels.*.name, 'deploy')
name: Post URL pr-${{ github.event.pull_request.number }} to PR comments
runs-on: ubuntu-latest
needs: [deploy-stage]
permissions:
pull-requests: write
steps:
- name: Post URL to PR comments
uses: marocchino/sticky-pull-request-comment@5060d4700a91de252c87eeddd2da026382d9298a
with:
message: |
The review app is available at this URL:
https://pr-${{ github.event.pull_request.number }}.manage-breast-screening.non-live.screening.nhs.uk
You must authenticate with HTTP basic authentication. Ask the team for credentials.