Skip to content

Post output of action in dry-run mode as a PR comment #143

@lopopolo

Description

@lopopolo

I currently have a dedicated workflow for running this action which is configured like this:

---
"on":
  push:
    branches:
      - trunk
    paths:
      - .github/labels.yaml
      - .github/workflows/repo-labels.yaml
  pull_request:
    branches:
      - trunk
    paths:
      - .github/labels.yaml
      - .github/workflows/repo-labels.yaml
  schedule:
    - cron: "0 0 * * TUE"
name: Create Repository Labels
jobs:
  labels:
    name: Synchronize repository labels
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Sync GitHub Issue Labels
        uses: crazy-max/ghaction-github-labeler@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          yaml-file: .github/labels.yaml
          skip-delete: false
          dry-run: ${{ github.ref != 'refs/heads/trunk' }}

PRs that modify either the workflow or the labels trigger a dry run. Once merged to the main branch, the GH Action is run in live mode.

When run in dry-run mode on a PR, I'd like the option to post the output which appears in the workflow job logs as a comment on the action. I usually do this manually to make sure I didn't do any typos and the action makes the changes I expect: artichoke/docker-artichoke-nightly#44.

I don't think I can implement this myself with a action script because I can't capture the output of the labeler action.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions