Skip to content

Dry run not working on Pull request using GitHub Actions workflow #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
supraja2805 opened this issue Apr 29, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@supraja2805
Copy link

Problem Description

Dry run mode is not working on GitHub actions workflow when pull request is opened

What is actually happening

Its giving Error message as below
"Unexpected error during full sync: TypeError: Cannot read properties of undefined (reading 'check_suite')"

What is the expected behavior

It needs to be generated a report in pull request with the expected changes

Error output, if available

Unexpected error during full sync: TypeError: Cannot read properties of undefined (reading 'check_suite')

Context

Are you using the hosted instance of probot/settings or running your own?

Running own

If running your own instance, are you using it with github.com or GitHub Enterprise?

GitHub.com

Version of probot/settings

safe-settings@0.1.0-rc.26 full-sync

Version of GitHub Enterprise

@supraja2805 supraja2805 added the bug Something isn't working label Apr 29, 2025
@supraja2805
Copy link
Author

workflow file:

name: Safe Settings Sync
on:
push:
branches:
- main
pull_request:
paths:
- safe-settings/**
- .github/workflows/safe-settings.yaml
schedule:
- cron: 0 */4 * * *

-->

workflow_dispatch:
inputs:
NOOP:
description: 'Run in no-op mode'
required: false
type: boolean
default: false

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
safe-settings-sync:
runs-on: ubuntu-latest
env:
SAFE_SETTINGS_VERSION: 2.1.17
SAFE_SETTINGS_CODE_DIR: .safe-settings-code
FULL_SYNC_FROM_REF: ${{ github.ref }}
steps:
- name: Checkout source
uses: actions/checkout@11bd719

  - name: Checkout GitHub Safe-Settings repository
    uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
    with:
      path: ${{ env.SAFE_SETTINGS_CODE_DIR }}
      ref: ${{ env.SAFE_SETTINGS_VERSION }}
      repository: github/safe-settings

  - name: Setup Node.js
    uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610
    with:
      cache-dependency-path:
        ${{ env.SAFE_SETTINGS_CODE_DIR }}/package-lock.json
      cache: npm
      node-version-file: ${{ env.SAFE_SETTINGS_CODE_DIR }}/.nvmrc

  - name: Install dependencies
    run: npm install
    working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}

  # -->
  - name: Set no-op mode flag
    run: |
      echo "FULL_SYNC_NOOP=false" >> $GITHUB_ENV

      if [[ "${{ github.event_name }}" == "pull_request" ]]; then
        echo "FULL_SYNC_NOOP=true" >> $GITHUB_ENV
      fi

      if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
        if [[ "${{ inputs.NOOP }}" != "" ]]; then
          echo "FULL_SYNC_NOOP=${{ inputs.NOOP }}" >> $GITHUB_ENV
        fi
      fi

  - name: Run application
    run: npm run full-sync
    working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}
    env:
      ADMIN_REPO: admin
      APP_ID: ${{ vars.SAFE_SETTINGS_APP_ID }}
      BLOCK_REPO_RENAME_BY_HUMAN: false
      CONFIG_PATH: safe-settings
      DEPLOYMENT_CONFIG_FILE_PATH:
        ${{ github.workspace }}/safe-settings/deployment.yaml
      GH_ORG: ${{ vars.SAFE_SETTINGS_GH_ORG }}
      GITHUB_CLIENT_ID: ${{ vars.SAFE_SETTINGS_GITHUB_CLIENT_ID }}
      GITHUB_CLIENT_SECRET:
        ${{ secrets.SAFE_SETTINGS_GITHUB_CLIENT_SECRET }}
      LOG_LEVEL: debug
      ENABLE_PR_COMMENT: true
      CREATE_PR_COMMENT: true
      PRIVATE_KEY: ${{ secrets.SAFE_SETTINGS_PRIVATE_KEY }}
      FULL_SYNC_NOP: ${{ env.FULL_SYNC_NOOP }}
      SETTINGS_FILE_PATH: organisation.yaml

@PendaGTP
Copy link
Contributor

@supraja2805 You can check this example https://github.com/UCL-MIRSG/.github/blob/main/.github/workflows/safe-settings.yaml. Please also set the LOG_LEVEL to trace to see if we can get more debug info to understand where this issue comes from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants