diff options
| author | Camelid <camelidcamel@gmail.com> | 2021-01-23 13:38:22 -0800 |
|---|---|---|
| committer | Joshua Nelson <joshua@yottadb.com> | 2021-02-03 19:29:07 -0500 |
| commit | bc320e7800f445939aa5c35c2c6bd019e15d1ecc (patch) | |
| tree | b3d89b68cc402e15d561ca7757ebe8d6cf02c898 /src/doc/rustc-dev-guide/.github/workflows | |
| parent | 9fb6690ae99afc1d7d350953eb378629ab507bc2 (diff) | |
| download | rust-bc320e7800f445939aa5c35c2c6bd019e15d1ecc.tar.gz rust-bc320e7800f445939aa5c35c2c6bd019e15d1ecc.zip | |
Implement date-checker
This tool looks for HTML comments like `<!-- date: 2021-01 -->` in each Markdown source file and compiles a list of dates that are older than six months. It then opens an issue with that list, with checkboxes for each file and date. Note that it will only open an issue if there was at least one date older than six months; it does nothing if the list is empty. This tool is automatically run monthly in a GitHub Actions workflow. I have tested the tool on a private repo and confirmed that it works.
Diffstat (limited to 'src/doc/rustc-dev-guide/.github/workflows')
| -rw-r--r-- | src/doc/rustc-dev-guide/.github/workflows/date-check.yml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/.github/workflows/date-check.yml b/src/doc/rustc-dev-guide/.github/workflows/date-check.yml new file mode 100644 index 00000000000..41111723585 --- /dev/null +++ b/src/doc/rustc-dev-guide/.github/workflows/date-check.yml @@ -0,0 +1,44 @@ +name: Date-Check + +on: + schedule: + # Run at noon UTC every 1st of the month + - cron: '00 12 01 * *' + + # Allow manually starting the workflow + workflow_dispatch: + +jobs: + date-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Run `date-check` + working-directory: ci/date-check + run: | + cargo run -- ../../src/ > ../../date-check-output.txt + + - name: Open issue + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const fs = require('fs'); + + const rawText = fs.readFileSync('date-check-output.txt', { encoding: 'utf8' }); + const title = rawText.split('\n')[0]; + if (title != 'empty') { + const body = rawText.split('\n').slice(1).join('\n'); + github.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title, + body, + }); + console.log('Opened issue.'); + } else { + console.log('No dates to triage.'); + } |
