Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set GH_REPO env var in Go license script #206

Merged
merged 6 commits into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/add-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
with:
repository: cdktf/cdktf-provider-${{ matrix.provider }}-go
token: ${{ secrets.GH_COMMENT_TOKEN }}
fetch-depth: 0
path: provider

- name: Setup Copywrite
Expand All @@ -46,16 +47,29 @@ jobs:
git config user.email "github-team-tf-cdk@hashicorp.com"
working-directory: ./provider

- name: Delete old branches from previous runs
run: |
git branch -r | egrep -o "add-update-license-file.*" | xargs -n 1 git push origin --delete
working-directory: ./provider
continue-on-error: true

- name: Add Mozilla Public License
run: copywrite license --spdx "MPL-2.0"
working-directory: ./provider
env:
GH_REPO: cdktf/cdktf-provider-${{ matrix.provider }}-go
GITHUB_TOKEN: ${{ secrets.GH_COMMENT_TOKEN }}

- name: Check for changes
id: git_diff
run: |
if (( $(git status -s | wc -l) > 0 )); then echo "has_changes=true" >> $GITHUB_OUTPUT; fi
working-directory: ./provider

- if: steps.git_diff.outputs.has_changes
name: Sleep for 2 seconds to avoid rate limits
run: sleep 2s

- if: steps.git_diff.outputs.has_changes
name: Commit license file and push changes
run: |
Expand All @@ -70,6 +84,8 @@ jobs:
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.GH_COMMENT_TOKEN }}
retries: 5
retry-exempt-status-codes: 400,401,404
script: |
const {resolve} = require('path')
const scriptPath = resolve("./main/.github/lib/create-pr")
Expand Down