Skip to content
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

Comments added by Merge Schedule always specifies UTC time #94

Open
atoftegaard-git opened this issue Nov 1, 2023 · 0 comments
Open

Comments

@atoftegaard-git
Copy link

Comments added by Merge Schedule always specifies UTC time, even though another time zone has been specified in the merge-schedule.yml workflow file.

In handle-pull-request.ts it looks like it should reflect the time zone in the comments added, but that doesn't seem to be the case:

if (datestring) {
if (!isValidDate(datestring)) {
commentBody = generateBody(
`"${datestring}" is not a valid date`,
"error"
);
} else if (new Date(datestring) < localeDate()) {
let message = `${stringifyDate(datestring)} (UTC) is already in the past`;
if (process.env.INPUT_TIME_ZONE !== "UTC") {
message = `${message} on ${process.env.INPUT_TIME_ZONE} time zone`;
}
commentBody = generateBody(message, "warning");
} else {
commentBody = generateBody(
`Scheduled to be merged on ${stringifyDate(datestring)} (UTC)`,
"pending"
);
}

merge-schedule.yml

name: Merge Schedule

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize
  schedule:
    # https://crontab.guru/every-hour
    - cron: '*/15 * * * *'

jobs:
  merge_schedule:
    runs-on: ubuntu-latest
    steps:
      - uses: gr2m/merge-schedule-action@v2
        with:
          # Merge method to use. Possible values are merge, squash or
          # rebase. Default is merge.
          merge_method: merge
          # Time zone to use. Default is UTC.
          time_zone: 'Europe/Copenhagen'
          # Require all pull request statuses to be successful before
          # merging. Default is `false`.
          require_statuses_success: 'true'
          # Label to apply to the pull request if the merge fails. Default is
          # `automerge-fail`.
          automerge_fail_label: 'merge-schedule-failed'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Example of flow in PR
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant