diff --git a/.github/workflows/diff-tour.yml b/.github/workflows/diff-tour.yml index 25a20de07..78abbc7c5 100644 --- a/.github/workflows/diff-tour.yml +++ b/.github/workflows/diff-tour.yml @@ -1,26 +1,27 @@ -name: Diff Tour link +# This GitHub Action imported from the shared action +# https://github.com/sourcegraph/actions/blob/main/diff-tour/ +# Please make fixes / enhancements in the shared action, +# so all of our repos get the benefits -# Posts a comment on each pull request linking to the Sourcegraph Diff Tour -# for the changes in that PR, and keeps the comment up to date as the PR -# changes. Once the PR is merged, the link points at the merge commit. -# -# Pull requests from forks are skipped: their GITHUB_TOKEN is read-only, so -# the comment cannot be posted. +name: Diff Tour link on: pull_request: - types: [opened, synchronize, reopened, closed] + # `edited` fires when the base branch changes; `synchronize` does not + # `closed` fires on merge and on plain close; either way the comment is + # updated to a link that survives deleting the head branch + types: [closed, edited, opened, reopened, synchronize] +# The only permission needed. The action does not check out your repo, so +# `contents: read` is not required, even for private repos permissions: - contents: read pull-requests: write jobs: - diff-tour-link: - name: Comment the Diff Tour link on the pull request + diff-tour: + name: Comment runs-on: ubuntu-latest - if: > - github.event.pull_request.head.repo.full_name == github.repository - && (github.event.action != 'closed' || github.event.pull_request.merged) + # Diff Tour resolves branch names against the base repo, so skip fork PRs + if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: sourcegraph/actions/diff-tour@main