Resource Counts #10
This file contains hidden or 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: Resource Counts | |
| on: | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: '0 9 * * WED' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate Token | |
| id: generate_token | |
| uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| installation_retrieval_mode: id | |
| installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} | |
| private_key: ${{secrets.APP_PEM }} | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd | |
| with: | |
| terraform_version: ${{ env.TERRAFORM_VERSION }} | |
| terraform_wrapper: false | |
| - run: | | |
| touch main.tf | |
| cat << EOF > main.tf | |
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| } | |
| } | |
| } | |
| EOF | |
| - run: terraform init | |
| - run: | | |
| datasources=$(terraform providers schema -json | jq '.provider_schemas[] .data_source_schemas | length' | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta') | |
| resources=$(terraform providers schema -json | jq '.provider_schemas[] .resource_schemas | length' | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta') | |
| sed -r -i "s/With ([0-9,]+) resources and ([0-9,]+) data sources,/With $resources resources and $datasources data sources,/" website/docs/index.html.markdown | |
| - run: | | |
| rm main.tf | |
| rm .terraform.lock.hcl | |
| rm -rf .terraform | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| with: | |
| token: ${{ steps.generate_token.outputs.token }} | |
| branch: "resource-counts" | |
| commit-message: "docs: update resource counts" | |
| title: "docs: update resource counts" | |
| body: "This PR updates the resource/data source counts included on the provider documentation index page." |