CLOUDP-319582: Run gen-purl as part of dependabot workflow #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: Update PURLs list for dependabot prs | |
| on: | |
| pull_request | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| repository-projects: read | |
| jobs: | |
| update-purls: | |
| name: Update PURLs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
| with: | |
| config: ${{ vars.PERMISSIONS_CONFIG }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4.1.1 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 0 | |
| - name: Fetch Go version from go.mod | |
| id: go-version | |
| run: | | |
| echo "GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ steps.go-version.outputs.GO_VERSION }} | |
| - name: Run Make Command | |
| run: | | |
| make gen-purls | |
| - name: Set Apix Bot token | |
| id: app-token | |
| uses: mongodb/apix-action/token@3024080388613583e3bd119bfb1ab4b4dbf43c42 | |
| with: | |
| app-id: ${{ secrets.APIXBOT_APP_ID }} | |
| private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
| - name: Commit updated purls.txt if changed | |
| env: | |
| BRANCH_NAME: ${{ github.head_ref }} | |
| run: | | |
| echo "Changes to purls.txt:" | |
| if git diff --exit-code build/package/purls.txt; then | |
| echo "No changes to purls.txt" | |
| else | |
| git config --global user.name "${{ steps.app-token.outputs.user-name }}" | |
| git config --global user.email "${{ steps.app-token.outputs.user-email }}" | |
| git add build/package/purls.txt | |
| git commit -m "chore: update purls.txt" | |
| git push origin "$BRANCH_NAME" | |
| fi |