generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 25
47 lines (43 loc) · 1.49 KB
/
watch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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'],
})