Skip to content

Conversation

@StephanTLavavej
Copy link
Member

Followup to #1764. Thanks again to @isra-fel.

This adds .github/workflows/update-status-chart.yml to main, which will tell GitHub Actions to update the Status Chart once a day. (At 7 AM UTC; that's because the Status Chart inspects issues at 11 PM Pacific Time, which is 6 AM UTC during Pacific Daylight Time (UTC-7) and 7 AM UTC during Pacific Standard Time (UTC-8). The run isn't instantaneous, and it appears that GitHub waits a few minutes to load-balance; any amount of delay is fine.)

I've re-enabled GitHub Actions for microsoft/STL, set the permissions to allow actions created by GitHub (this uses only actions/checkout@v2 and actions/setup-node@v2), and deleted the ancient workflows from our initial experimentation almost a year ago. Finally, I've relaxed the branch protection policy for gh-pages, which would prevent these automated commits.

Co-authored-by: Yeming Liu <Yeming.Liu@microsoft.com>
@StephanTLavavej StephanTLavavej added the infrastructure Related to repository automation label Mar 23, 2021
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner March 23, 2021 06:56
@CaseyCarter CaseyCarter self-assigned this Mar 23, 2021
Co-authored-by: Casey Carter <cartec69@gmail.com>
@StephanTLavavej
Copy link
Member Author

I've pushed one more change to make the action succeed when there's nothing to do (e.g. if it's being run manually when less than a day has elapsed, or if it's a scheduled run but a manual push had recently updated the tables). git commit will return a failure code when there's nothing to commit, so we should use

git diff-index --quiet HEAD || git commit -m "Automated update."

to attempt the commit only when the working tree has changed. (git add and git push will succeed when there's nothing to do. I suppose we could use git diff-index to guard this entire step, but that seemed like a larger change.)

I've tested this in my fork, along with the suggested change of scoping the PAT to just the gather_stats.js invocation.

@StephanTLavavej StephanTLavavej merged commit 02b238c into microsoft:main Apr 5, 2021
@AdamBucior
Copy link
Contributor

This caused me a weird problem after I updated main branch in my fork from upstream/main. It tries to run this but fails because I don't have gh-pages branch in my fork (and it sends me annoying emails that it failed). Would it be possible to move it to that branch?

@StephanTLavavej
Copy link
Member Author

@AdamBucior Hmm - according to my understanding, only the default branch can run scheduled workflows, so this has to be in main. Can you simply disable GitHub Actions for your fork? (That's what I did for mine after completing this PR.) Click on your fork's Settings tab > Actions > Disable Actions should work.

Alternatively, it looks like we can teach the action to run only for microsoft/STL. The documentation indicates that if: ${{ github.repository == 'microsoft/STL' }} should work. Although this would make it slightly harder for contributors to test changes to the action (they'd have to temporarily remove this guard), it would automatically do the right thing for all forks, and is useful for maintainers who work on the Status Chart itself (I had to disable the action in my fork, so that only microsoft/STL performs automatic updates). I'll submit a PR for that soon, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Related to repository automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants