Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

The Release workflow was failing because gh pr create is not permitted to create pull requests when invoked by GitHub Actions, causing the error: GitHub Actions is not permitted to create or approve pull requests (createPullRequest).

Changes

  • Replaced custom bash script with peter-evans/create-pull-request@v7 action
    • Removed 24-line script that configured git, created branch, committed changes, and attempted PR creation via gh CLI
    • Replaced with 8-line declarative action configuration
    • Maintains identical behavior: same commit message, branch naming pattern (automated-documentation-update-${{ github.run_id }}), and file pattern (*/**/README.md)

Before:

- name: Create PR for Documentation
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    # ... 24 lines of bash script
    gh pr create --title "$message" --body "$message"

After:

- name: Create Pull Request for Documentation
  uses: peter-evans/create-pull-request@v7
  with:
    commit-message: 'Automated documentation update [skip ci]'
    branch: automated-documentation-update-${{ github.run_id }}
    title: 'Automated documentation update'
    body: 'Auto-generated documentation from feature publishing'
    add-paths: |
      */**/README.md

This is the recommended approach for creating PRs in GitHub Actions workflows.

Original prompt

Can you investigate the Releast action failure and investigate possibly implamenting
Solution: Use peter-evans/create-pull-request Action
This is the recommended and most reliable method for creating PRs in GitHub Actions:

yaml
Copy code
name: "Release dev container features & Generate Documentation"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/**/devcontainer-feature.json' # Triggers on any devcontainer-feature.json change

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
packages: write
steps:
- uses: actions/checkout@v6

  - name: "Publish Features"
    uses: devcontainers/action@v1
    with:
      publish-features: "true"
      base-path-to-features: "./src"
      generate-docs: "true"
      
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  - name: Create Pull Request for Documentation
    uses: peter-evans/create-pull-request@v7
    with:
      commit-message: 'Automated documentation update [skip ci]'
      branch: automated-documentation-update-${{ github.run_id }}
      title: 'Automated documentation update'
      body: 'Auto-generated documentation from feature publishing'
      add-paths: |
        */**/README.md

into the release flow instead


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Datacom-Ayden <221437541+Datacom-Ayden@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate Releast action failure and use create-pull-request action Fix Release workflow: replace gh pr create with peter-evans/create-pull-request action Dec 5, 2025
Copilot AI requested a review from Datacom-Ayden December 5, 2025 07:43
@Datacom-Ayden Datacom-Ayden marked this pull request as ready for review December 5, 2025 07:47
@Datacom-Ayden Datacom-Ayden merged commit d293d6a into main Dec 5, 2025
12 checks passed
@Datacom-Ayden Datacom-Ayden deleted the copilot/investigate-releast-action-failure branch December 5, 2025 07:47
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

Successfully merging this pull request may close these issues.

2 participants