Skip to content

watch

watch #1392

Workflow file for this run

name: watch
on:
schedule:
- cron: "0 0 * * *"
jobs:
azure_docs:
name: azure-docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v7
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'],
})