fix(ci): dependabot submodule comment permissions #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Submodule Changes | |
| on: | |
| pull_request: | |
| # types: | |
| # - opened | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| jobs: | |
| changes: | |
| name: Submodule Changes | |
| if: github.actor == 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: get changes | |
| id: changes | |
| run: | | |
| for sm in $(grep 'path = ' .gitmodules | awk '{print $3}'); do | |
| shas=$(git diff origin/${{ github.base_ref }} --submodule=short -- $sm) | |
| if [ -n "$shas" ]; then | |
| git diff origin/${{ github.base_ref }} --submodule=log -- $sm | tee -a changes.txt | |
| pushd $sm | |
| echo "Files changes:" | tee -a changes.txt | |
| git diff --name-only $shas | tee -a changes.txt | |
| popd | |
| fi | |
| done | |
| echo "changes<<EOF" >> $GITHUB_OUTPUT | |
| cat changes.txt >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: comment | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `## Submodule Changes\n\n\`\`\`\n${{ steps.changes.outputs.changes }}\n\`\`\`` | |
| }) |