Skip to content

Commit

Permalink
Implement copyright action
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Jan 8, 2024
1 parent 892c21e commit d6e6f65
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/update-copyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Copyright

on:
schedule:
# Runs "At 08:00 on day-of-month 1 in January"
- cron: '0 8 1 1 *'

workflow_dispatch:

env:
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI

jobs:
copyright:
name: Copyright
runs-on: macos-13
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/ruby-cache
- run: bundle exec fastlane copyright
timeout-minutes: 5
env:
GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "You shall not pass!"
job_name: "${{ github.workflow }}: ${{ github.job }}"
fields: message,commit,author,action,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
if: failure()
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ GEM
fastlane
pry
fastlane-plugin-sonarcloud_metric_kit (0.2.1)
fastlane-plugin-stream_actions (0.3.25)
fastlane-plugin-stream_actions (0.3.26)
xctest_list (= 1.2.1)
fastlane-plugin-versioning (0.5.2)
ffi (1.16.3)
Expand Down Expand Up @@ -427,7 +427,7 @@ DEPENDENCIES
fastlane-plugin-emerge
fastlane-plugin-lizard
fastlane-plugin-sonarcloud_metric_kit
fastlane-plugin-stream_actions (= 0.3.25)
fastlane-plugin-stream_actions (= 0.3.26)
fastlane-plugin-versioning
jazzy
json
Expand Down
21 changes: 21 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,27 @@ lane :sources_matrix do
}
end

lane :copyright do
update_copyright(ignore: [derived_data_path, source_packages_path])
next unless is_ci

branch_name = "ci/update-copyright-#{Time.now.to_i}"
commit_message = '[CI] Update Copyright'
sh("git checkout -b #{branch_name}")
sh('git add -A')
sh("git commit -m '#{commit_message}'")
push_to_git_remote(tags: false)

create_pull_request(
api_token: ENV.fetch('GITHUB_TOKEN', nil),
repo: github_repo,
title: commit_message,
head: branch_name,
base: 'develop',
body: 'This PR was created automatically by CI.'
)
end

private_lane :current_branch do
ENV['BRANCH_NAME'] || git_branch
end
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem 'fastlane-plugin-versioning'
gem 'fastlane-plugin-emerge'
gem 'fastlane-plugin-create_xcframework'
gem 'fastlane-plugin-sonarcloud_metric_kit'
gem 'fastlane-plugin-stream_actions', '0.3.25'
gem 'fastlane-plugin-stream_actions', '0.3.26'

0 comments on commit d6e6f65

Please sign in to comment.