watch #1141
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: watch | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
azure_docs: | |
name: azure-docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Calculate diff | |
run: | | |
curl https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/virtual-machines/sizes.md --output .github/snapshots/size.md | |
git diff > snapshot.diff | |
- name: Create an issue | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const issues = await github.rest.issues.listForRepo({ | |
owner: 'terraform-linters', | |
repo: 'tflint-ruleset-azurerm', | |
state: 'open', | |
labels: ['bot'] | |
}) | |
if (issues.data.length !== 0) { | |
console.log("Issue already opened. Skipped.") | |
return | |
} | |
const fs = require('fs') | |
const data = fs.readFileSync('snapshot.diff', 'utf-8') | |
if (data === "") { | |
console.log("No diff. Skipped.") | |
return | |
} | |
github.rest.issues.create({ | |
owner: 'terraform-linters', | |
repo: 'tflint-ruleset-azurerm', | |
title: '🤖 MicrosoftDocs/azure-docs Changes Report', | |
body: "Changes found from the saved snapshots :eyes:\n\n```diff\n" + data + "```\n\nhttps://github.com/MicrosoftDocs/azure-docs/blob/main/articles/virtual-machines/sizes.md", | |
labels: ['bot'], | |
}) |