Skip to content

Commit 02d26ad

Browse files
committed
github yml: reformat
1 parent acf774d commit 02d26ad

File tree

5 files changed

+138
-142
lines changed

5 files changed

+138
-142
lines changed

.github/workflows/add-maintainer-custom-property.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,45 @@
22
# to all repositories in this organization
33
name: Add Maintainer as Custom Property to Repositories
44
on:
5-
schedule:
6-
- cron: '0 0 1 * *'
7-
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 1 * *"
7+
workflow_dispatch:
88

99
jobs:
10-
run:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14-
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15-
with:
16-
node-version: '20.x'
17-
- id: npm
18-
run: cd ${{ github.workspace }}; npm ci
19-
shell: bash
20-
- name: run
21-
id: run
22-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
23-
env:
24-
IGNORE_MAINTAINERS: brave-builds,brave-browser-releases,brave-support-admin
25-
DEBUG: false
26-
with:
27-
github-token: ${{ secrets.CUSTOM_PROPERTY_MANAGER_GITHUB_TOKEN }}
28-
script: |
29-
console.log('${{ github.workspace }}/src/addMaintainerCustomProperty.js');
30-
const { default: addMaintainerCustomProperty } = await import('${{ github.workspace }}/src/addMaintainerCustomProperty.js');
31-
return await addMaintainerCustomProperty({
32-
org: process.env.GITHUB_REPOSITORY_OWNER,
33-
github: github,
34-
ignoreMaintainers: process.env.IGNORE_MAINTAINERS,
35-
debug: process.env.DEBUG
36-
});
37-
38-
- uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a # v1.1.0
39-
if: ${{ fromJson(steps.run.outputs.result) != '' }}
40-
with:
41-
slack_token: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
42-
message: |
43-
[add-maintainer-custom-property] ${{ fromJson(steps.run.outputs.result) }}
44-
channel: secops-hotspots
45-
color: yellow
46-
verbose: false
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15+
with:
16+
node-version: "20.x"
17+
- id: npm
18+
run: cd ${{ github.workspace }}; npm ci
19+
shell: bash
20+
- name: run
21+
id: run
22+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
23+
env:
24+
IGNORE_MAINTAINERS: brave-builds,brave-browser-releases,brave-support-admin
25+
DEBUG: false
26+
with:
27+
github-token: ${{ secrets.CUSTOM_PROPERTY_MANAGER_GITHUB_TOKEN }}
28+
script: |
29+
console.log('${{ github.workspace }}/src/addMaintainerCustomProperty.js');
30+
const { default: addMaintainerCustomProperty } = await import('${{ github.workspace }}/src/addMaintainerCustomProperty.js');
31+
return await addMaintainerCustomProperty({
32+
org: process.env.GITHUB_REPOSITORY_OWNER,
33+
github: github,
34+
ignoreMaintainers: process.env.IGNORE_MAINTAINERS,
35+
debug: process.env.DEBUG
36+
});
37+
38+
- uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a # v1.1.0
39+
if: ${{ fromJson(steps.run.outputs.result) != '' }}
40+
with:
41+
slack_token: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
42+
message: |
43+
[add-maintainer-custom-property] ${{ fromJson(steps.run.outputs.result) }}
44+
channel: secops-hotspots
45+
color: yellow
46+
verbose: false

.github/workflows/dependabot-auto-dismiss.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
run:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14-
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15-
with:
16-
node-version: '20.x'
17-
- id: npm
18-
run: cd ${{ github.workspace }}; npm ci
19-
shell: bash
20-
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
21-
env:
22-
SLACK_TOKEN: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
23-
SLACK_CHANNEL: '#secops-hotspots'
24-
DEBUG: false
25-
with:
26-
github-token: ${{ secrets.DEPENDABOT_AUTO_DISMISS_GITHUB_TOKEN }}
27-
script: |
28-
const debug = process.env.DEBUG === 'true';
29-
const { default: sendSlackMessage } = await import('${{ github.workspace }}/src/sendSlackMessage.js');
30-
const { default: dependabotDismiss } = await import('${{ github.workspace }}/src/dependabotDismiss.js');
31-
const message = await dependabotDismiss({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, dependabotDismissConfig: '${{ github.workspace }}/.github/dependabot-dismiss.txt'});
32-
if (message.length > 0)
33-
await sendSlackMessage({debug, username: 'dependabot-auto-dismiss', message: message, channel: process.env.SLACK_CHANNEL, token: process.env.SLACK_TOKEN});
34-
35-
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15+
with:
16+
node-version: "20.x"
17+
- id: npm
18+
run: cd ${{ github.workspace }}; npm ci
19+
shell: bash
20+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
21+
env:
22+
SLACK_TOKEN: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
23+
SLACK_CHANNEL: "#secops-hotspots"
24+
DEBUG: false
25+
with:
26+
github-token: ${{ secrets.DEPENDABOT_AUTO_DISMISS_GITHUB_TOKEN }}
27+
script: |
28+
const debug = process.env.DEBUG === 'true';
29+
const { default: sendSlackMessage } = await import('${{ github.workspace }}/src/sendSlackMessage.js');
30+
const { default: dependabotDismiss } = await import('${{ github.workspace }}/src/dependabotDismiss.js');
31+
const message = await dependabotDismiss({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, dependabotDismissConfig: '${{ github.workspace }}/.github/dependabot-dismiss.txt'});
32+
if (message.length > 0)
33+
await sendSlackMessage({debug, username: 'dependabot-auto-dismiss', message: message, channel: process.env.SLACK_CHANNEL, token: process.env.SLACK_TOKEN});

.github/workflows/dependabot-nudge.yml

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,53 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
run:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14-
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15-
with:
16-
node-version: '20.x'
17-
- id: npm
18-
run: cd ${{ github.workspace }}; npm ci
19-
shell: bash
20-
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
21-
env:
22-
SLACK_TOKEN: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
23-
SLACK_CHANNEL: '#secops-hotspots'
24-
GH_TO_SLACK_USER_MAP: ${{ secrets.GH_TO_SLACK_USER_MAP }}
25-
DEBUG: false
26-
with:
27-
github-token: ${{ secrets.DEPENDABOT_NUDGE_GITHUB_TOKEN }}
28-
script: |
29-
const debug = process.env.DEBUG === 'true';
30-
const { default: sendSlackMessage } = await import('${{ github.workspace }}/src/sendSlackMessage.js');
31-
const { default: dependabotNudge } = await import('${{ github.workspace }}/src/dependabotNudge.js');
32-
33-
let githubToSlack = {};
34-
try {
35-
githubToSlack = JSON.parse(process.env.GH_TO_SLACK_USER_MAP);
36-
} catch (e) {
37-
if (debug) console.log('GH_TO_SLACK_USER_MAP is not valid JSON');
38-
}
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
15+
with:
16+
node-version: "20.x"
17+
- id: npm
18+
run: cd ${{ github.workspace }}; npm ci
19+
shell: bash
20+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
21+
env:
22+
SLACK_TOKEN: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
23+
SLACK_CHANNEL: "#secops-hotspots"
24+
GH_TO_SLACK_USER_MAP: ${{ secrets.GH_TO_SLACK_USER_MAP }}
25+
DEBUG: false
26+
with:
27+
github-token: ${{ secrets.DEPENDABOT_NUDGE_GITHUB_TOKEN }}
28+
script: |
29+
const debug = process.env.DEBUG === 'true';
30+
const { default: sendSlackMessage } = await import('${{ github.workspace }}/src/sendSlackMessage.js');
31+
const { default: dependabotNudge } = await import('${{ github.workspace }}/src/dependabotNudge.js');
3932
40-
// set minlevel to 'medium' if it's the first Monday of the month, otherwise stick to high or critical issues
41-
let minlevel = 'medium';
42-
const today = new Date();
43-
const firstMonday = new Date(today.getFullYear(), today.getMonth(), 1 + (1 - today.getDay()) % 7);
44-
if (today.getMonth() !== firstMonday.getMonth() || today.getDate() !== firstMonday.getDate()) {
45-
if (debug)
46-
console.log('Not the first Monday of the month!');
47-
minlevel = 'high';
48-
}
33+
let githubToSlack = {};
34+
try {
35+
githubToSlack = JSON.parse(process.env.GH_TO_SLACK_USER_MAP);
36+
} catch (e) {
37+
if (debug) console.log('GH_TO_SLACK_USER_MAP is not valid JSON');
38+
}
4939
50-
const messages = await dependabotNudge({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, minlevel: minlevel, githubToSlack: githubToSlack});
51-
52-
for (const message of messages) {
53-
try {
54-
await sendSlackMessage({debug, username: 'dependabot', message: message, channel: process.env.SLACK_CHANNEL, token: process.env.SLACK_TOKEN});
55-
} catch (error) {
56-
if (debug)
57-
console.log(error);
58-
}
59-
}
40+
// set minlevel to 'medium' if it's the first Monday of the month, otherwise stick to high or critical issues
41+
let minlevel = 'medium';
42+
const today = new Date();
43+
const firstMonday = new Date(today.getFullYear(), today.getMonth(), 1 + (1 - today.getDay()) % 7);
44+
if (today.getMonth() !== firstMonday.getMonth() || today.getDate() !== firstMonday.getDate()) {
45+
if (debug)
46+
console.log('Not the first Monday of the month!');
47+
minlevel = 'high';
48+
}
6049
50+
const messages = await dependabotNudge({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, minlevel: minlevel, githubToSlack: githubToSlack});
6151
52+
for (const message of messages) {
53+
try {
54+
await sendSlackMessage({debug, username: 'dependabot', message: message, channel: process.env.SLACK_CHANNEL, token: process.env.SLACK_TOKEN});
55+
} catch (error) {
56+
if (debug)
57+
console.log(error);
58+
}
59+
}

.github/workflows/mirror.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: Mirror Repo
22
on:
33
schedule:
44
# nightly (0th hour 0th minute of every day)
5-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
66
workflow_dispatch:
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Mirror
13-
shell: bash
14-
run: |
15-
if [[ "$GITHUB_REPOSITORY_OWNER" != "brave" ]]; then
16-
git clone "https://github.com/brave/${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}"
17-
cd ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}
18-
git remote add github "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git"
19-
git push -fu github main
20-
fi
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
- name: Mirror
13+
shell: bash
14+
run: |
15+
if [[ "$GITHUB_REPOSITORY_OWNER" != "brave" ]]; then
16+
git clone "https://github.com/brave/${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}"
17+
cd ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}
18+
git remote add github "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git"
19+
git push -fu github main
20+
fi
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/older-than-2y.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: Older Than 2 Years Informer
22
on:
33
schedule:
44
# Every month, first day of the month
5-
- cron: '0 0 1 * *'
5+
- cron: "0 0 1 * *"
66
workflow_dispatch:
7-
7+
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Older Than 2 Years Informer
13-
id: older-than-2y
14-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
15-
with:
12+
- name: Older Than 2 Years Informer
13+
id: older-than-2y
14+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
15+
with:
1616
github-token: ${{ secrets.GH_PAT }}
1717
script: |
1818
const org = process.env.GITHUB_REPOSITORY_OWNER;
19-
19+
2020
function formatInMessage(r) {
2121
var pushedAt = new Date(r.pushed_at);
2222
return `- ${r.private ? '😎 ' : ''} ${r.full_name} ${r.html_url}\t🌟 ${r.stargazers_count}🍴${r.forks} - Last pushed ${pushedAt.getFullYear()}/${pushedAt.getMonth()}/${pushedAt.getDay()+1}\n`
@@ -53,12 +53,12 @@ jobs:
5353
core.setSecret(message);
5454
5555
return message;
56-
- uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a # v1.1.0
57-
if: ${{ fromJson(steps.older-than-2y.outputs.result) != '' }}
58-
with:
59-
slack_token: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
60-
message: |
61-
[older-than-2y] ${{ fromJson(steps.older-than-2y.outputs.result) }}
62-
channel: secops-hotspots
63-
color: blue
64-
verbose: false
56+
- uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a # v1.1.0
57+
if: ${{ fromJson(steps.older-than-2y.outputs.result) != '' }}
58+
with:
59+
slack_token: ${{ secrets.HOTSPOTS_SLACK_TOKEN }}
60+
message: |
61+
[older-than-2y] ${{ fromJson(steps.older-than-2y.outputs.result) }}
62+
channel: secops-hotspots
63+
color: blue
64+
verbose: false

0 commit comments

Comments
 (0)