brave-isolated-world.yaml: catch extra regex #223
Workflow file for this run
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: Check New Repos | |
on: | |
schedule: | |
# nightly (0th hour 0th minute of every day) | |
- cron: '0 0 * * *' | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check New Repos | |
id: check-new-repos | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GH_PAT }} | |
script: | | |
var query = `query ($owner: String!) { | |
repositoryOwner(login: $owner) { | |
repositories(last: 100) { | |
totalCount | |
nodes { | |
name | |
createdAt | |
} | |
} | |
} | |
}`; | |
const variables = { | |
owner: context.repo.owner | |
} | |
const result = await github.graphql(query, variables); | |
const totalCount = result.repositoryOwner.repositories.totalCount; | |
console.log("totalCount: %s", totalCount); | |
const repositories = result.repositoryOwner.repositories; | |
const yesterday = ((d) => d.setDate(d.getDate() - 1))(new Date()); | |
var newerThanADay = repositories.nodes.filter( | |
repo => new Date(repo.createdAt) > yesterday | |
); | |
console.log("NewerThanADay: %o", newerThanADay); | |
var message = ""; | |
if (newerThanADay.length > 0) { | |
message += `${newerThanADay.length} new repos in ${variables.owner}:\n\n`; | |
for (let i = 0; i < newerThanADay.length; i++) { | |
message += `- ${newerThanADay[i].name}\n`; | |
} | |
message += `\nTotal repositories in ${variables.owner}: ${totalCount}`; | |
} | |
return message; | |
- uses: actions-ecosystem/action-slack-notifier@v1 | |
if: ${{ fromJson(steps.check-new-repos.outputs.result) != '' }} | |
with: | |
slack_token: ${{ secrets.HOTSPOTS_SLACK_TOKEN }} | |
message: | | |
[check-new-repos] ${{ fromJson(steps.check-new-repos.outputs.result) }} | |
channel: secops-hotspots | |
color: yellow | |
verbose: false |