static_content_update_main #7512
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: Update static content [main] | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [static_content_update_main] | |
concurrency: | |
group: sync_static_content_update_main | |
cancel-in-progress: true | |
jobs: | |
build_deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.16.0 | |
cache: 'npm' | |
- run: git pull origin # jbum added | |
- run: npm ci --production | |
- name: Check for static content updates # update static content repo. | |
run: | | |
npm update static-content-cannabis --production | |
- name: Create Pull Request # https://github.com/marketplace/actions/create-pull-request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
committer: ${{ secrets.ODI_GITHUB_USER }} <[email protected]> | |
base: main | |
title: "Static content update to main branch" | |
body: | | |
Method: api.cannabis.ca.gov (WordPress REST API, Pantheon) > @cagov/cannabis-lambda-sync-github (AWS CloudFormation, arc.codes) > @cagov/static-content-cannabis (Static content repo, main branch) | |
labels: | | |
content-update | |
automerge | |
commit-message: "Automated PR: Static content update" | |
# team-reviewers: | | |
# ${{ secrets.PR_REVIEWERS }} | |
- name: Check outputs | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | |
- name: Auto approve static content update changes # https://github.com/hmarr/auto-approve-action | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
uses: hmarr/auto-approve-action@v2 | |
with: | |
github-token: ${{ secrets.ODI_GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
- id: automerge | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
name: Auto merge static content update | |
uses: "pascalgn/[email protected]" | |
env: | |
GITHUB_TOKEN: "${{ secrets.ODI_GITHUB_TOKEN }}" |