@@ -22,15 +22,51 @@ jobs:
2222 generate-docs : " true"
2323 base-path-to-features : " ./src"
2424
25- - name : Create Pull Request for Documentation
26- uses : peter-evans/create-pull-request@v6
25+ - name : Generate GitHub App Token
26+ id : generate_token
27+ 2728 with :
28- app-id : ${{ secrets.DEVCONTAINERS_APP_ID }}
29- private-key : ${{ secrets.DEVCONTAINERS_APP_CLIENT_SECRET }}
30- commit-message : Automated documentation update [skip ci]
31- title : Automated documentation update
32- body : |
33- Automated documentation update by the Devcontainers app.
34- This PR includes updates to README.md files generated by the workflow.
35- branch : automated-documentation-update-${{ github.run_id }}
36- base : main
29+ app_id : ${{ secrets.DEVCONTAINERS_APP_ID }}
30+ private_key : ${{ secrets.DEVCONTAINERS_APP_CLIENT_SECRET }}
31+
32+ - name : Commit and Create PR for Documentation
33+ env :
34+ GH_TOKEN : ${{ steps.generate_token.outputs.token }}
35+ run : |
36+ set -e
37+ echo "Configuring Git..."
38+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+ git config --global user.name "github-actions[bot]"
40+ git config pull.rebase false
41+
42+ branch="automated-documentation-update-${{ github.run_id }}"
43+ echo "Checking out new branch: $branch"
44+ git checkout -b "$branch"
45+
46+ commit_message='Automated documentation update'
47+ pr_title='Automated documentation update'
48+ pr_body='Automated documentation update by the Devcontainers app.\\nThis PR includes updates to README.md files generated by the workflow.'
49+
50+ echo "Adding updated README.md files..."
51+ # Assuming READMEs are updated within the src directory structure
52+ git add src/**/README.md
53+
54+ echo "Checking for changes..."
55+ if git diff --staged --quiet; then
56+ echo "No changes to commit. Exiting."
57+ exit 0
58+ fi
59+
60+ echo "Committing changes..."
61+ git commit -m "$commit_message [skip ci]"
62+
63+ echo "Pushing changes to origin/$branch..."
64+ git push origin "$branch"
65+
66+ echo "Creating pull request..."
67+ gh pr create \\
68+ --title "$pr_title" \\
69+ --body "$pr_body" \\
70+ --head "$branch" \\
71+ --base "main"
72+ echo "Pull request created successfully."
0 commit comments