Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:20-alpine
WORKDIR /opt/safe-settings
ENV NODE_ENV production
ENV NODE_ENV=production
## Set the Labels
LABEL version="1.0" \
description="Probot app which is a modified version of Settings Probot GitHub App" \
Expand All @@ -22,4 +22,4 @@ USER node

## This does not start properly when using the ['npm','start'] format
## so stick with just calling it outright
CMD npm start
CMD ["npm", "start"]
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,10 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
robot.log.debug(`Updating check run ${JSON.stringify(params)}`)
await context.octokit.checks.update(params)

// guarding against null value from upstream libary that is
// causing a 404 and the check to stall
// from issue: https://github.com/github/safe-settings/issues/185#issuecomment-1075240374
if (check_suite.before === '0000000000000000000000000000000000000000') {
if (env.PR_USE_BASE_SHA === 'true') {
check_suite.before = check_suite.pull_requests[0].base.sha
robot.log.debug(`Using PR's base sha: ${check_suite.before}...${check_suite.after}`)
} else if (check_suite.before === '0000000000000000000000000000000000000000') {
check_suite.before = check_suite.pull_requests[0].base.sha
}
params = Object.assign(context.repo(), { basehead: `${check_suite.before}...${check_suite.after}` })
Expand Down
1 change: 1 addition & 0 deletions lib/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
SETTINGS_FILE_PATH: process.env.SETTINGS_FILE_PATH || 'settings.yml',
DEPLOYMENT_CONFIG_FILE_PATH: process.env.DEPLOYMENT_CONFIG_FILE || 'deployment-settings.yml',
CREATE_PR_COMMENT: process.env.CREATE_PR_COMMENT || 'true',
PR_USE_BASE_SHA: process.env.PR_USE_BASE_SHA || 'false',
CREATE_ERROR_ISSUE: process.env.CREATE_ERROR_ISSUE || 'true',
BLOCK_REPO_RENAME_BY_HUMAN: process.env.BLOCK_REPO_RENAME_BY_HUMAN || 'false',
FULL_SYNC_NOP: process.env.FULL_SYNC_NOP === 'true'
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/rulesets.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const version = {
'X-GitHub-Api-Version': '2022-11-28'
}
module.exports = class Rulesets extends Diffable {
constructor (nop, github, repo, entries, log, errors, scope) {
constructor(nop, github, repo, entries, log, errors, scope) {
super(nop, github, repo, entries, log, errors)
this.github = github
this.repo = repo
Expand All @@ -28,7 +28,7 @@ module.exports = class Rulesets extends Diffable {
// Find all Rulesets for this org
find () {
if (this.scope === 'org') {
this.log.debug(`Getting all rulesets for the org ${this.org}`)
this.log.debug(`Getting all rulesets for the org ${this.repo.owner}`)

const listOptions = this.github.request.endpoint.merge('GET /orgs/{org}/rulesets', {
org: this.repo.owner,
Expand Down
3 changes: 3 additions & 0 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Settings {
static async syncAll (nop, context, repo, config, ref) {
const settings = new Settings(nop, context, repo, config, ref)
try {
settings.log.debug('Starting syncAll')
await settings.loadConfigs()
// settings.repoConfigs = await settings.getRepoConfigs()
await settings.updateOrg()
Expand All @@ -33,6 +34,7 @@ class Settings {
static async syncSubOrgs (nop, context, suborg, repo, config, ref) {
const settings = new Settings(nop, context, repo, config, ref, suborg)
try {
settings.log.debug('Starting syncSubOrgs')
await settings.loadConfigs()
await settings.updateAll()
await settings.handleResults()
Expand All @@ -45,6 +47,7 @@ class Settings {
static async sync (nop, context, repo, config, ref) {
const settings = new Settings(nop, context, repo, config, ref)
try {
settings.log.debug('Starting sync')
await settings.loadConfigs(repo)
if (settings.isRestricted(repo.repo)) {
return
Expand Down