Debian Codegraph @

.github/workflows/update_coc.yml

raw
1 name: Update Code of Conduct
2
3 permissions:
4 contents: read
5
6 concurrency:
7 group: ${{ github.workflow }}-${{ github.ref }}
8 cancel-in-progress: true
9
10 on:
11 workflow_dispatch:
12 # Run every Sunday at midnight UTC (00:00) - triggered by webhook?
13 schedule:
14 - cron: "0 0 * * SUN"
15
16 jobs:
17 update_code_of_conduct:
18 permissions:
19 contents: write # needed for CoC PR
20 pull-requests: write # needed for CoC PR
21
22 runs-on: ubuntu-latest
23
24 steps:
25 - name: Checkout repository
26 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
27 with:
28 persist-credentials: false
29
30 - name: Fetch CODE_OF_CONDUCT.md from django-commons
31 run: |
32 curl -o fetched_code_of_conduct.md https://raw.githubusercontent.com/django-commons/membership/main/CODE_OF_CONDUCT.md
33
34 - name: Check if CODE_OF_CONDUCT.md has changed
35 id: check_changes
36 run: |
37 if cmp -s fetched_code_of_conduct.md CODE_OF_CONDUCT.md; then
38 echo "No changes in CODE_OF_CONDUCT.md"
39 echo "changed=false" >> $GITHUB_OUTPUT
40 else
41 echo "CODE_OF_CONDUCT.md has changed"
42 echo "changed=true" >> $GITHUB_OUTPUT
43 cp fetched_code_of_conduct.md CODE_OF_CONDUCT.md
44 fi
45
46 # Create a pull request to merge the changes into the main branch
47 - name: Create Pull Request
48 if: steps.check_changes.outputs.changed == 'true'
49 uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1
50 with:
51 token: ${{ secrets.GITHUB_TOKEN }}
52 branch: bot-update-coc
53 add-paths: |
54 CODE_OF_CONDUCT.md
55 title: "🤖 Update Code of Conduct 🤖"
56 body: "Update the Code of Conduct with the latest version from the django-commons repository."
57 commit-message: "Update CODE_OF_CONDUCT.md from django-commons"